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 storage class?
Differentiate between Macro and ordinary definition.
What is call by value in c?
What are the valid places to have keyword “break”?
What is Dynamic memory allocation in C? Name the dynamic allocation functions.
Which is best linux os?
Is c is a middle level language?
What is a null pointer assignment error? What are bus errors, memory faults, and core dumps?
What is the g value paradox?
When a c file is executed there are many files that are automatically opened what are they files?
Can I use base-2 constants (something like 0b101010)? Is there a printf format for binary?
What is call by reference in functions?
List the different types of c tokens?
Why is c called c not d or e?
What is structure in c explain with example?