Thursday, 16 November 2017

C Program to Find Sum of the Series 1/1! + 2/2! + 3/3! + ……1/N!


Code:

#include   stdio.h

double sumseries(double);

main()
{
    double number,sum;
    printf("\n Enter the value:  ");
    scanf("%lf", &number);
    sum = sumseries(number);
    printf("\n Sum of the above series = %lf ", sum);
}

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);
}


Output:

Enter the value:  5
Sum of the above series = 2.708333


More C Programs:









100+ Best Home Decoration Ideas For Christmas Day 2019 To Make Home Beautiful

Best gifts for Christmas Day | Greeting cards for Christmas Day | Gift your children a new gift on Christmas day This Christmas d...