Write a program to compute the following
1!+2!+...n!
Answer Posted / ashish
#include<stdio.h>
int n_fact(int n);
void main()
{
int n,res;
printf("ENTER A NUMBER:-");
scanf("%d",&n);
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 ? | 5 Yes | 6 No |
Post New Answer View All Answers
how we can make 3d venturing graphics on outer interface
Is c a great language, or what?
What is wrong in this statement?
Can main () be called recursively?
I just typed in this program, and it is acting strangely. Can you see anything wrong with it?
How many keywords (reserve words) are in c?
What are near, far and huge pointers?
What are the 5 types of inheritance in c ++?
Write a program to show the change in position of a cursor using c
What is use of #include in c?
is it possible to create your own header files?
What does 3 periods mean in texting?
Explain the use of function toupper() with and example code?
How can variables be characterized?
An integer that indentifies the position of a data item in a sequence of data items a) value b) number c) index d) all of the above