Answer the question
In order to leave comments, you need to log in
Euclid's algorithm?
I've been sitting all day and can't understand how the program is executed by the code. Finding the greatest common divisor.
Here is the code
Def gcd(a, b) :
return a If b==0 else gcd(b, a%b)
а<b
how will it work.? Answer the question
In order to leave comments, you need to log in
Yes. In the first step, a and b are swapped (i.e. the next call will be gcd(456, 243), so a is always greater than b until b is 0.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question