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


Please Help Members By Posting Answers For Below Questions

What is function prototype?

607


What are data types in c language?

578


Is c object oriented?

535


explain how do you use macro?

664


What is static and auto variables in c?

559






What is 02d in c?

632


What is break in c?

580


simple program of graphics and their output display

1464


Can math operations be performed on a void pointer?

583


What does c value mean?

616


What is nested structure?

567


What is printf () in c?

576


What is c programing language?

612


Write a C/C++ program to add a user to MySQL. The user should be permitted to only "INSERT" into the given database.

1491


What is scanf_s in c?

629