代码:
#include<stdio.h> int main() { int ret = 1; int sum = 0; for (int n = 1;n <= 10;n++) { ret = ret * n; sum = sum + ret; } printf("sum=%d\n", sum); return 0; }
编写程序,输出1-10阶乘的和 (C语言)
于 2023-07-28 17:00:00 首次发布
代码:
#include<stdio.h> int main() { int ret = 1; int sum = 0; for (int n = 1;n <= 10;n++) { ret = ret * n; sum = sum + ret; } printf("sum=%d\n", sum); return 0; }