Eculid's Algorithhm

why does the sequence of giving input does not matter here matlab hum chahe phele bada no. de fir chota ya vice-versa but hume same output milta hai
lekin code mai return gcd(b,a%b)
hum b ka mod kar rahe hai taaki vo 0 ho jaaye ?

if b > a, then in call gcd(b ,a%b) a would become b and b would be come a%b = a, So the next call would be gcd(a, b%a). Which would be the correct call.

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.