题解 | #n的阶乘#
n的阶乘
http://www.nowcoder.com/practice/97be22ee50b14cccad2787998ca628c8
【C++】已通过
#include<algorithm>
using namespace std;
long long int f(int n) {
long long int res = 1;
for (int i = 1; i <= n; i++) {
res *= i;
}
return res;
}
int main() {
int n;
while (cin >> n) {
cout << f(n) << endl;
}
return 0;
}