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


Please Help Members By Posting Answers For Below Questions

Here is a neat trick for checking whether two strings are equal

562


Is void a keyword in c?

572


How can I ensure that integer arithmetic doesnt overflow?

604


What is c variable?

549


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.

1494






What is the use of ?

619


Where local variables are stored in c?

554


will u please send me the placement papers to my mail???????????????????

1360


What are the 5 elements of structure?

561


What is wrong in this statement? scanf(ā€œ%dā€,whatnumber);

723


Why is c called "mother" language?

855


any "C" function by default returns an a) int value b) float value c) char value d) a & b

663


How many levels of indirection in pointers can you have in a single declaration?

590


largest Of three Number using without if condition?

1005


Write a code on reverse string and its complexity.

606