What does this print for n=4?
<code>void p(int n) { if (n == 0) return; System.out.print(n); p(n - 1); } </code></pre>
- Acheck_circle
4321
- B
0
- C
4
- D
1234
Explanation
Print n, then recursively p(n-1): 4, 3, 2, 1.
AP Computer Science A· difficulty 4/5
What does this print for n=4?
<code>void p(int n) { if (n == 0) return; System.out.print(n); p(n - 1); } </code></pre>
4321
0
4
1234
Explanation
Print n, then recursively p(n-1): 4, 3, 2, 1.
Want 10 more like this — adaptive to your weak spots?