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:

Here is an implementation of the summation of N factorial(N的阶乘求和)

相关文章:

  • 2021-11-17
  • 2021-11-17
  • 2021-09-18
  • 2021-11-17
  • 2022-12-23
  • 2021-11-17
  • 2021-09-08
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-11-17
  • 2021-11-17
  • 2021-11-17
  • 2021-11-17
  • 2021-11-17
相关资源
相似解决方案