Factorial of j numbers

#include <stdio.h>
#include <conio.h>

int fact (int);

void main ()
{
int n,i,s=0;

printf ("using this program you can find summation of n consecutive number
with their factorial/n/n1!+2!+3!+.....+n!/n/nenter last number =");

scanf ("%d",&n);

for (i=1;i=<n;i++)
{
ret=fact (i);
s=s+ret;
}

for (i=1;i <=n;i++)
{
Printf ("%d!",i);

if (i <n)
{
printf ("+");
}
}

printf ("=%d ",s);

getch ();
return;
}

int fact (int n)
{
int i, f=1;

for (i=1;i <=n;i++)
{
f=f×i;
}

return (f);
}

Post a Comment

0 Comments