#include <stdio.h>
#include<conio.h>
int main()
{
long n,m,s=0,h=1;
printf("enter the value");
scanf("%d",&n);
for(m=1;m<=n;m++)
{
h=h*m;
s=s+h;
}
printf("%ld",s);
getch();
return 0;
}
enter the value6
873
--------------------------------
Process exited after 5.11 seconds with return value 0
Press any key to continue . . .