public int mystery(int b)
{
if (b == 0) // checks if 2 == 0, which is false
return 0;
if (b % 2 == 0) // checks if 2 is even, which is true
return mystery(b - 1) + 3; // call 1
// stops at call 1 and calls m(1)
else
return mystery(b - 1) + 2; // call 2
}
Call stack
m(1)
m(2)1
m(3)2
m(4)1
m(5)2