Question PRG-C-0070
HardWhat is the output of this program?
#include <stdio.h>
int f(int n) { return n <= 1 ? 1 : n * f(n - 1); }
int g(int n) { return n == 0 ? 0 : n % 10 + g(n / 10); }
int main() {
printf("%d %d", f(5), g(9045));
return 0;
}
- A.
60 18
- B.
24 18
- C.
Sign up free to see the answer and a step-by-step explanation.