the-honk/c/calculators/helpers/factorial.c
2021-12-21 20:16:51 +00:00

9 lines
101 B
C

int factorial(int n) {
int ans = 1;
for (int i = 2; i <= n; i++) {
ans *= i;
}
return ans;
}