Write a Python program to find the greatest common divisor (GCD)(Euclidean algorithm) and print the result.


Topic: Write a Python program to find the greatest common divisor (GCD)(Euclidean algorithm) and print the result.

Solution

a = int(input())
b = int(input())
while a != 0 and b != 0:
    if a > b:
        a %= b
    else:
        b %= a
gcd = a + b
print(gcd)



List all Python Programs