Came across this code which I think is pretty interesting 🙂
int fun(int a)
{
if(a == 1 || a == 0)
return 1;
if(a%2 == 0)
return fun(a/2) + 2;
else
return fun(a – 1) + 3;
}
void main()
{
cout << fun(5) ;
}
What would cout print? 😀
really simple and fun problem 🙂