Hello everyone!
I am having difficulty understanding the code in this article on the Greatest Common Divisor of two numbers:
I am trying to implement the Euclidean Algorithm but I am getting an incorrect output. Here is my code:
The output I am getting is 8, when I am expecting 4. Can someone please explain why this is happening and how to fix it?HTML Code:def gcd(a, b): if b == 0: return a else: return gcd(b, a % b) print(gcd(20, 8))
Thank you!