Question: if i enter 12 explain how the answer is 9 by doing it step by step public static int recmethod (int n) { if (n

if i enter 12 explain how the answer is 9 by doing it step by step

public static int recmethod (int n) { if (n == 3){ return 3; } return recmethod ((n % 4) + 1) + 2; } 

public static int recmethod (int n) { if (n == 3){ return 3; } return recmethod ((n % 4) + 1) + 2; }

Step by Step Solution

3.42 Rating (171 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Lets break down the code step by step for the input value 12 You call the recmethod function with th... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!