Answer to Question #24573 in Action Script | Flash | Flex | ColdFusion for Ladarva

Question #24573
Write a C program to find the sum of the series 1+ 1/2! +1/3! + 1/4! +..............+ 1/n!
1
Expert's answer
2013-02-19T08:32:23-0500
#include <stdio.h>

int main()
{
printf("Enter n:\n");
unsigned n=0;
do
{
scanf( "%d", &n);
}
while ( n==0 );

double fact=1;
double sum=0;
int i;
for ( i=1; i<=n; ++i )
{
fact=fact/i;
sum=sum+fact;
}

printf( "Sum=%f\n", sum);

return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

Assignment Expert
22.02.13, 09:37

You're welcome. We are glad to be helpful. If you really liked our service please press like-button beside answer field. Thank you!

Ladarva
22.02.13, 09:29

Thank u vry mch.....it works!!!!!!!!!!!!!!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS