In Java, What value is returned as a result of the call nasty(5,5); ?

public static int nasty(int a, int b)
{
if (a==b)
return a * b;
else if (a % b == 0)
return nasty(b,b);
else if (a < b)
return nasty(b,a);
else
return nasty(1,nasty(a-1,b+1));
}

(A)1
(B)5
(C)10
(D)25
 
Back
Top