I have been given this function and I am trying to understand the logic behind it. I was given: puzzle(25) and puzzle(38); and the following code:
Code:
void puzzle (int n)
{
    if (n!=0)
    {
        puzzle (n/2);
        putchar ('0'+n%2);
    }
}
I added a print statement and my outputs are, 11, 13, 06, 012 & 125 for puzzle(25) and 11, 02, 04, 19, 119 and 038 for puzzle(38). I am assuming i did this function correctly by havint it printf the (int n) value.

Can someone help me with this? I really appreciate it and thanks!