Write a program to compute the following
1!+2!+...n!
Answer Posted / fhghg
#include<stdio.h>
int n_fact(int n);
void main()
{
int n,res=0;
printf("ENTER A NUMBER:-");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
res+=n_fact(n);
}
printf("%d",res);
}
int n_fact(n)
{
int result;
if(n=0)
result=1;
else
result=n*n_fact(n-1);
return(result);
}
| Is This Answer Correct ? | 8 Yes | 2 No |
Post New Answer View All Answers
Explain About fork()?
What is pivot in c?
What do you know about the use of bit field?
Why does this code crash?
Hai sir, I had planned to write the NIC scientific engineer exam , plz post the sample question......
What is substring in c?
What is far pointer in c?
Why is c called "mother" language?
what is recursion in C
How can I read in an object file and jump to locations in it?
Is c dynamically typed?
Can a variable be both static and volatile in c?
What is the scope of global variable in c?
What are the applications of c language?
Was 2000 a leap year?