def main():
print("This program finds the greatest common divisor for two integers using two different algorithms")
a,b = eval(input("Enter two integers, separated by comma: "))
print("You entered: ", a, " and", b)
print("\n The First Algorithm:")
guess=min(a,b)
print("The smallest integer is ", guess)
print("Let's assign this value to guess variable.")
counter1=0 # used for counting the number of interations of while loop
while (a%guess != 0) or (b%guess != 0):
guess -=1
print("The new guess is ", guess)
counter1 +=1
print("ANSWER: The gcd of", a, "and", b, "is", guess)
print("\n The Second Algorithm (Euclid's) :")
u, v = a, b
counter2=0 # used for counting the number of interations of while loop
while v != 0:
r = u % v
print("The remainder is", r)
u = v
v = r
counter2 +=1
print("ANSWER: The gcd of", a, "and", b, "is", u)
print("\n Analysis of two algorithms:")
print("First algorithm performed", counter1, "iterations")
print("Euclid's algorithm performed", counter2, "iterations")
main()