public static int f(int n) {
System.out.print(n + " ");
if (n == 0) return 0;
return f(n - 1);
}
f(3);What is printed (and returned)?
- A
3
- Bcheck_circle
3 2 1 0
- C
0 1 2 3
- D
3 2 1
Explanation
Each call prints n then recurses. n goes 3,2,1,0. Returns 0.