You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
#include <bits/stdc++.h>
|
|
|
|
//用递归法计算阶乘
|
|
int f(int n) {
|
|
return n == 0 ? 1 : f(n - 1) * n; //注意三元表达式,学生们一般不常用这个
|
|
}
|
|
|
|
int main() {
|
|
printf("%d\n", f(10));
|
|
return 0;
|
|
} |