most efficient way to calculate factorial code example
Example: calculate factorial
int factorial(int n) {
int res = 1, i;
for (i = 2; i <= n; i++)
res *= i;
return res;
}
int factorial(int n) {
int res = 1, i;
for (i = 2; i <= n; i++)
res *= i;
return res;
}