Advertisement

Advertisement

Advertisement

Write a program to calculate summation of series

1/1! + 2/2! + 3/3! +….+ n/n!

Advertisement

#### Solution

```
#include <stdio.h>
#include <conio.h>
double sumseries(double m)
{
double sum2 = 0, f = 1, i;
for (i = 1; i <= m; i++)
{
f = f * i;
sum2 = sum2 +(i / f);
}
return(sum2);
}
double sumseries(double);
main()
{
double number,sum;
clrscr();
printf("\n Enter the value: ");
scanf("%lf", &number);
sum = sumseries(number);
printf("\n Sum of the above series = %lf ", sum);
}
```

Output: Enter the value: 4 Sum of the above series = 2.666667 |

Concept: Array

Is there an error in this question or solution?