In the problem of hacker blocks

in the problem of hacker blocks the input was 16 and 24
that is when we pass these num. to the function gcd
a=16 and b=24 . but a should be > b as in recursion gcd(b.a%b) is written ?

@mehulbhandari358 if a<b then one more recursive call will be made,we do not need to check if a is greater or not while calling. As you can see that when we make recursive call gcd(b, a%b) then for the called function a would become greater than b.
If this resolves your doubt mark it as resolved.

yeah a should be > than b but we are sending 16,24 as arguments ?

@mehulbhandari358 Hey as I said, we do not need to check the relation between a and b. I explained the same above. Let me give you example.
gcd(16,24)
Now in the gcd function

gcd(int a,int b)
{
     if(b==0)                                               // b=24,  a=16
           return a;
    return gcd(b,a%b);                              //   placing values of a and b    gcd(24,16%24) will call 
                                                   //    gcd(24,16)    now for this called function a will be 24 and b 
                                                  //     will be 16, we dont so we do not need to see the relation between 
                                                 // a and b, the function is self adjusting. 
} 

If this resolves your doubt mark it as resolved.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.