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 function prototype?
What are data types in c language?
Is c object oriented?
explain how do you use macro?
What is static and auto variables in c?
What is 02d in c?
What is break in c?
simple program of graphics and their output display
Can math operations be performed on a void pointer?
What does c value mean?
What is nested structure?
What is printf () in c?
What is c programing language?
Write a C/C++ program to add a user to MySQL. The user should be permitted to only "INSERT" into the given database.
What is scanf_s in c?