Write a program to compute the following
1!+2!+...n!
Answer Posted / vignesh1988i
#include<stdio.h>
#include<conio.h>
long factorial(int,long);
void main()
{
int i,m;
long sum=0,k=1;
clrscr();
printf("enter ur no. of terms :");
scanf("%d",&m);
i=1;
while(i<=m)
{
k=factorial(i,k);
sum+=k;
i++;
}
printf("the sum is : %ld",sum);
getch();
}
int factorial(int i,long k)
{
return (i*k);
}
hope this also correct...
thank u
| Is This Answer Correct ? | 3 Yes | 0 No |
Post New Answer View All Answers
What is the use of bitwise operator?
In C language, a variable name cannot contain?
How can I use a preprocessorif expression to ?
Explain continue keyword in c
What is main return c?
Why is c faster?
How can I get back to the interactive keyboard if stdin is redirected?
difference between Low, Middle, High Level languages in c ?
What is the meaning of c in c language?
A c program to display count values from 0 to 100 and flash each digit for a secong.reset the counter after it reaches 100.use for loop,. pls guys hepl me.. :(
Why can arithmetic operations not be performed on void pointers?
What is #define in c?
Can we change the value of #define in c?
What is a char in c?
How can variables be characterized?