1、question:
1!+2!+3!+……+N!
2、code:
#include<iostream>
#include<cstdio>
using namespace std;int jc(int x)
{
int y=1;
for(int i=1;i<=x;i++)
{
y=y*i;
}
return y;
}
int n,sum;
int main()
{
scanf("%d",&n);
for(int i=1;i<=n;i++)
{
sum+=jc(i);
}
printf("%d",sum);
return 0;
}
3、result: