c program to manipulate x=1!+2!+3!+...+n! using recursion
Answer / satya
#include<stdio.h>
#include<conio.h>
int sumfact(int n)
{ int cnt=0,out;
if(cnt==0)
out=1;
if(n==1)
return out;
else
{
int i,fact=1;
for(i=n;i>=2;i--)
fact*=i;
out+=fact;
cnt++;
return out+sumfact(n-1);
}
}
main()
{
int out,n;
clrscr();
printf("Enter the vlue of n ");
scanf("%d",&n);
out=sumfact(n);
printf("%d",out);
getch();
}
| Is This Answer Correct ? | 6 Yes | 6 No |
what do u mean by Direct access files? then can u explain about Direct Access Files?
In the following control structure which is faster? 1.Switch 2.If-else and which consumes more memory?
Write program to remove duplicate in an array?
can we initialize all the members of union?
Can you mix old-style and new-style function syntax?
In the DOS enveronment, normal RAM that resides beyond the 1mb mark. a) expanded memory b) swapped memory c) Extended memory d) none
what is c language?
what is the use of keyword volatile??
errors in computer programmes are called
What is the use of getch ()?
#define MAX 3 main() { printf("MAX = %d \n",MAX ); #undef MAX #ifdef MAX printf("Vector Instituteā); #endif
Is a house a shell structure?