Program to print value of 1/1! + 2/2! + 3/3! +.....+ n/n! || C programming
In this, we are going to see a program in which we will print the value of 1/1! + 2/2! + 3/3! +.....+ n/n! in C Programming Language.

//WAP to print 1/1! + 2/2! + 3/3! +.....+ n/n!
#include <stdio.h>

void main()
{
    int n, fact = 1;
    float b, sum = 0, i;
    printf("Enter the number: ");
    scanf("%d", &n);

    for (i = 1; i <= n; i++)
    {
        fact = fact * i;
        b = i / fact;
        sum = sum + b;
    }
    printf("The sum is : %f", sum);
}


#ENJOY CODING


Post a Comment

FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP

Previous Post Next Post