Print sum of a factorial series | user given limit | C-Program

Sum of factorial series:

Tips:

1.Take variables.
2. Use nested loop.
3. Factorial of variables then add them. 

Code:

#include<stdio.h>

void main()

{
    int x,i,j,a,b=0,n;

    printf("Enter the range:\n");

    scanf("%d",&x);

    for(i=1;i<=x;i++)

    {
        if(x!=i)

            printf("%d!/%d +",i,i);

        else

            printf("%d!/%d =",i,i);

        a=1;

        for(j=1;j<=i;j++)

            a=(a*j);

            a=a/i;

            b=b+a;
    }

    printf("%d",b);

}

Output:

 

Comments

Popular posts from this blog

TOP 10 PROGRAMMING LANGAUAGES COMMING 2021 | ARTICLE

Write a C-program to swap two number:

Print Fibonacci Series using Recursion | C program :