Having trouble understanding how this recursive function works.

int F( int X )
{
return (X<=0) ? 3 : F(X/2)+F(X-3);
}

I understand the first part, give it a value 0 or less, get back 3, fine. But greater values I don't understand 2 returns 9, 3 returns 9, 4 returns 15. How?

Having trouble understanding how this recursive function works.

int F( int X )
{
return (X<=0) ? 3 : F(X/2)+F(X-3);
}

I understand the first part, give it a value 0 or less, get back 3, fine. But greater values I don't understand 2 returns 9, 3 returns 9, 4 returns 15. How?

It's equivalent to this function. Not sure if that's what your question is.

int F( int X )
{
if (X <= 0)
return 3;
else
return F(X/2) + F(X-3);
}

I'm aware of how the trinary operator works, its what's going on in the function that has me stumped. After it checks the value to see if its lets than or equal to zero, what is it doing afterwards to return a value?

INGGRIS
How to connect device scanner with visual basic, its analogy I made button scan in vb and typing button scan in press scanner live and walk .. how? Help ...

Greetings,
I have been trying to figure this out for hours with no avail. Basically I need to print out user input as Initial value, ASCII(char), ASCII(int), and Hex. I ...