喜欢就关注作者吧,代码如下:
num1 = input('请输入第一个数字:')
num1 = int(num1)
num2 = input('请输入第二个数字:')
num2 = int(num2)
smaller = min(num1, num2)
a = smaller / 2 + 2
a = int(a)
for i in range(1, a):
if num1 % i == 0 and num2 % i ==0:
result = i
print(f'{num1}和{num2}的最大公约数是{result}')