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 bash c?
How can you tell whether a program was compiled using c versus c++?
What is the process to create increment and decrement stamen in c?
Is c object oriented?
What is uint8 in c?
Given below are three different ways to print the character for ASCII code 88. Which is the correct way1) char c = 88; cout << c << " ";2) cout.put(88);3) cout << char(88) << " "; a) 1 b) 2 c) 3 d) constant
What is substring in c?
What is the benefit of using #define to declare a constant?
What is putchar() function?
How will you delete a node in DLL?
What is the most efficient way to store flag values?
What is sizeof array in c?
Which header file is essential for using strcmp function?
Why does notstrcat(string, "!");Work?
What is d'n in c?