C Program Sum Factorial Series

By | March 11, 2020

C Program Sum Factorial Series

  C program to calculate and print 
  sum of the series 1!+2!+3!+...+n!
  C program to print the sum of 
  factorials of natural numbers 
  from 1 to n.
int main()
    int i,n,sum;
	long fact=1;
    printf("Enter the value of n: ");
    /* loop to calculate sum from 1 to n*/
		fact = fact * i;
		sum= sum+ fact;
    /*display the sum on screen*/
    printf("The Sum of the series 1!+2!+3!+...+%d! is: %d\n",n,sum);
    return 0;

Enter the value of n: 5
The Sum of the series 1!+2!+3!+…+5! is: 153

 7,140 total views,  8 views today

Leave a Reply

Your email address will not be published.