OneCompiler

gcd

149

def euclids(a,b):
if(b==0):
return a
return euclids(b,a%b)
def consecutive(a,b):
t= min(a,b)
while(t>0):
if(a%t==0 and b%t==0):
return t
t-=1
a=int(input("Enter first number: "))
b=int(input("Enter second number: "))
euc=euclids(a,b)
cons=consecutive(a,b)
print(f"EUCLIDS ALGO--- gcd{a,b}={euc}")
print(f"CONSECUTIVE INTEGER ALGO--- gcd{a,b}={cons}")