πŸ“Š C Programming
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
πŸ’¬ Discuss
βœ… Correct Answer: (C) 24

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

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

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
72
Total Visits
πŸ“½οΈ
11 mo ago
Published
πŸŽ–οΈ
Mr. Dubey
Publisher
πŸ“ˆ
91%
Success Rate