题解 | #n的阶乘#
n的阶乘
https://www.nowcoder.com/practice/97be22ee50b14cccad2787998ca628c8
#include <bits/stdc++.h> using namespace std; long long func(int n){//用ll因为int表示范围不够 if(n==1) return 1; else return func(n-1)*n; } int main() { int n; while(cin>>n){ printf("%lld\n",func(n)); } } // 64 位输出请用 printf("%lld")