A

Admin • 802.91K Points
Coach

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;
}
  • (A) 4
  • (B) 12
  • (C) 24
  • (D) 16
  • Correct Answer - Option(C)
  • Views: 5
  • Filed under category C Programming
  • Hashtags:

Explanation by: Admin
The factorial of 4 is 4*3*2*1 = 24.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.