#include <stdlib.h>
int main()
{
int n, i, j, factorial, sum=0;
printf("enter the value of n: ");
scanf("%d", &n);
for (i=1; i<=n; i++)
{
factorial = 1;
for (j=1; j<=i; j++)
{
factorial *=j;
}
sum += factorial;
}
printf("1! + 2! + 3! + ... + n! = %d\n", sum);
system("pause");
return 0;
}