0
14kviews
Write a program to calculate the sum of series: (1!/1)+(2!/2)+(3!/3)+(4!/4)+(5!/5)+.........+(n!/n)

Mumbai University> FE > Sem 2> STRUCTURED PROGRAMMING APPROACH

Marks: 10 M

Year: Dec 2016

1 Answer
1
1.6kviews
#include<stdio.h>
#include<conio.h>
main()
{
int i,n,fact=1;
float sum=0.0;
printf(“Enter Value of n:”);
scanf(“%d”,&n);

for(i=1;i<=n;i++)
{
fact=fact*i;
sum=sum+(fact/i);
}
prinf(“The value of series is %.4f”,sum);
getch();
}

Output:
Enter Value of n: 4
The value of series is 10.0000
Please log in to add an answer.