Code:
def g(x , y):
mod = 1
while(mod!=0):
mod = y % x
g = x
y = x
x = mod
return g
x = int(input("x: "))
y = int(input("y: "))
print(g(x , y))
Program to find the greatest common divisor in python.
Code:
def g(x , y):
mod = 1
while(mod!=0):
mod = y % x
g = x
y = x
x = mod
return g
x = int(input("x: "))
y = int(input("y: "))
print(g(x , y))
Program to find the greatest common divisor in python.
Code:-
Output:-