#include <stdio.h> /* 获取n的阶乘 注意这个返回值要为long long不然会精度不够 */ long long factorial(int n){ if(0 == n || 1 == n){ return 1; } return n * factorial(n - 1); } int main() { int n; while (scanf("%d", &n) != EOF) { // 注意 while 处理多个 case printf("%lld\n", factorial(n)); } return 0; }