#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<math.h>
int main()
{
int n = 0;
int ret = 1;
int j = 0;
int sum =0;
printf("请输入要求的阶乘:");
scanf("%d", &n);
for (j = 1; j <= n;j++)
{
ret = ret*j;
sum = sum + ret;
}
printf("%d\n",sum);
return 0;
}
求任意整数的阶乘(不考虑溢出情况)
最新推荐文章于 2021-12-22 23:19:07 发布