C Programming Tutorial

 
 
 
 
#include<stdio.h>
#include<conio.h>
void main()
{
        long int fact=1,i,n,sum=0;
        clrscr();
        printf(\"\\n ENTER THE VALUE OF N: \");
        scanf(\"%ld\",&n);
        printf(\"\\n THE SERIES IS \");
        for(i=1;i<=n;i++)
        {
            fact = fact * i;
            if(i==n)
                printf(\" %ld\",fact);
            else
                printf(\"%ld + \",fact);
                sum = sum + fact;
        }

        printf(\"\\n**************************************\");
        printf(\"\\nTHE FACTORIAL VALUE IS %ld the sum is %ld\",fact,sum);
        printf(\"\\n**************************************\");
        getch();

}

********************************* OUTPUT ***********************


     ENTER THE VALUE OF N: 5

     THE SERIES IS 1 + 2 + 6 + 24 +  120

     THE FACTORIAL VALUE IS 120 the sum is 153


****************************************************************

 
 
Didn't find what you were looking for? Find more on PROGRAM TO FIND ANSWER OF THE FOLLOWING SERIES. 1 + 2 + 6 + 24 + 120 + ......