Write a program to compute the following
1!+2!+...n!
Answer Posted / yamuna
/* A.Yamuna III BSC CS L.R.G. College , Tirupur*/
#include<stdio.h>
#include<conio.h>
void main()
{
int a,n;
int sum=1;
int total=0;
clrscr();
printf("Enter the number :");
scanf("%d",&n);
for(a=1;a<=n;a++)
{
for(int i=1;i<=a;i++)
{
sum=sum*i;
}
total=total+sum;
sum=1;
}
printf("The factorial is :%d",total);
getch();
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is a substring in c?
What is a wrapper function in c?
What is unary operator?
What is function pointer c?
How can I manipulate strings of multibyte characters?
all c language question
What is the value of uninitialized variable in c?
Why is structure padding done in c?
What is a global variable in c?
What is the difference between mpi and openmp?
Explain what is page thrashing?
Can the sizeof operator be used to tell the size of an array passed to a function?
When should the volatile modifier be used?
Is c pass by value or reference?
How we can insert comments in a c program?