Q. What will the following code print?
Code:
int fact(int n) {
if (n <= 1) return 1;
return n * fact(n - 1);
}
int main() {
printf("%d", fact(4));
return 0;
}
β
Correct Answer: (C)
24
Explanation: The factorial of 4 is 4*3*2*1 = 24.