int Cabin (int n);
int _tmain(int argc, _TCHAR* argv[])
{
cout << Cabin(8) << endl;
return 0;
}
int Cabin (int n)
{
if (n == 1)
return 0;
else
return Cabin(n/2) + 1;
}
Hi ,can someone explain why is the answer 3 here:if to folow the formula the answer is 8,5,3,2,1 and then if to return values,can not be 3,were is my mistake in logic?