num1 = int(input("请您输入一个数:"))
num2 = int(input("请您再输入一个数:"))
min = min(num1, num2)
sum = 1
list = []
prime = 2
while prime <= min:
if num1 % prime == 0 and num2 % prime == 0: # 两个数同时能被prime整除
list.append(prime) # list追加一个数字
num1 /= prime # 两个数同时对prime取整
num2 /= prime
else:
prime += 1
index = 0
while index < len(list):
sum *= list[index]
index += 1
print("这两个数的最大公约数为sum = %d" % sum)