c program to manipulate x=1!+2!+3!+...+n! using recursion
Answer Posted / 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 |
Post New Answer View All Answers
What is use of integral promotions in c?
Can you pass an entire structure to functions?
What extern c means?
Why c is a mother language?
Describe dynamic data structure in c programming language?
What is a c token and types of c tokens?
Write programs for String Reversal & Palindrome check
Is c still used?
Are negative numbers true in c?
Describe the difference between = and == symbols in c programming?
Hai what is the different types of versions and their differences
What is the most efficient way to store flag values?
How many bytes are occupied by near, far and huge pointers (dos)?
What is ponter?
What does return 1 means in c?