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);
}
Comments
Post a Comment
Give your feedback!
DO NOT SPAM !!
NO THIRD PARTY PROMOTIONAL LINK !!!! (else comment will be deleted.)