Grab the widget  Get Widgets

23 November 2011

Use C to get summation of a factorial sereis!

Looking to get summation of this series;
1!+2!+3!+.....+n!
You can do it simply using by C language.well that wouldn't be very much tough for you..but i am giving a sample here.To check this out click on read more.

Summation of factorial:
#include <stdio.h>
int main ()
{
    int fact=1,n,i,result=0;
    printf("Enter Number to see it's factorial and get the sumation:\n");
    scanf ("%d",&n);
    for (i=1;i<=n;i++)
    {
        fact=fact*i;
        printf("%d\n",fact);
        result=result+fact;
    }
printf("\nyour desired number's factorial is:%d\n",fact);
printf ("\nSummation is:%d\n",result);
    return 0;
}
You will need a compiler/software to run this program..Download Code Blocks from this url-

Download Code blocks latest version!!



Or you can use Google Code pad before download this software from here..

 

No comments:

Post a Comment