计算阶乘
#define _CRT_SECURE_NO_WARNINGS 1#include<stdio.h>int main(){ int a = 1; int ret = 1; int n = 1; int sum = 0; for (n = 1; n <= 10; n++) { ret = 1; for (a = 1; a <= n; a++) { ret = a*ret; } sum = ret + sum; } printf("%d\n", sum); return 0;}//计算1!+2!+3!……10!的结果int main(){ int a = 1; int ret = 1; int n = 1; int sum = 0; for (n = 1; n <= 10; n++) { ret = ret*n; sum = ret + sum; } printf("%d\n", sum); return 0;}//计算1!+2!+3!……10!的结果(对上面代码的优化)