#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main() {
int i = 0;
int n = 0;
int x = 1;
int sum = 0;
//1+2+6=9
for (n = 1;n <= 3;n++)
{
x = x * n;
//n的阶乘a
sum = sum + x;
}
printf("sum=%d\n", sum);
return 0;
}
C语言计算1!+2!+3!...+10! :
最新推荐文章于 2023-12-06 19:18:45 发布