10 lines
101 B
C
10 lines
101 B
C
|
int factorial(int n) {
|
||
|
int ans = 1;
|
||
|
|
||
|
for (int i = 2; i <= n; i++) {
|
||
|
ans *= i;
|
||
|
}
|
||
|
|
||
|
return ans;
|
||
|
}
|