Question: calling the function below with func5(4) outputs 2 4 3 2. Im having trouble following a logic tree to see that. can someone explain this
calling the function below with func5(4) outputs 2 4 3 2. Im having trouble following a logic tree to see that. can someone explain this to me simply? I think i understand how it prints the 2 but I have no idea how it prints the 4.
public static void func5(int n) { if (n == 0 || n == 1) return; func5(n - 2); System.out.print(n + " "); func5(n - 1); }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
