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 ternary operator in c?
What are the 5 types of organizational structures?
When do you not use the keyword 'return' when defining a function a) Always b) Never c) When the function returns void d) dfd
What is the advantage of c?
What happens if header file is included twice?
Why do we need arrays in c?
simple program of graphics and their output display
Can we assign integer value to char in c?
What is assert and when would I use it?
Do you know the difference between exit() and _exit() function in c?
What is #include stdio h?
What are the application of void data type in c?
What is the difference between a function and a method in c?
What is a function simple definition?
Write a program to swap two numbers without using the third variable?