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
Write a program of advanced Fibonacci series.
What is the use of typedef in structure in c?
Explain how do you print an address?
Explain enumerated types in c language?
Why can arithmetic operations not be performed on void pointers?
What is the difference between printf and scanf in c?
What is typedef struct in c?
Tell me about low level programming languages.
What is data type long in c?
Can you please explain the scope of static variables?
Write a program on swapping (100, 50)
How does placing some code lines between the comment symbol help in debugging the code?
What is 2c dna?
What is use of bit field?
What is a null pointer in c?