以下程序中使用了递推方式计算阶乘(n!=1×2...×n),计算结果正确。 int factorial(int n) { int res = 1; for (int i = 0; i < n; ++i) { res *= i; } return res; }