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
Here is a neat trick for checking whether two strings are equal
Is void a keyword in c?
How can I ensure that integer arithmetic doesnt overflow?
What is c variable?
I need a help with a program: Write a C program that uses data input in determining the whole of points A and a whole of circles B. Find two points in A so that the line which passes through them, cut through the maximum number of circles.
What is the use of ?
Where local variables are stored in c?
will u please send me the placement papers to my mail???????????????????
What are the 5 elements of structure?
What is wrong in this statement? scanf(ā%dā,whatnumber);
Why is c called "mother" language?
any "C" function by default returns an a) int value b) float value c) char value d) a & b
How many levels of indirection in pointers can you have in a single declaration?
largest Of three Number using without if condition?
Write a code on reverse string and its complexity.