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?