a=int(raw_input(‘a‘))
b=int(raw_input(‘b‘))
su=[]
if a>b:
smaller=b
else:
smaller=a
for i in range(1,smaller+1):
if a%i==0 and b%i==0:
su.append(i)
l=len(su)
p=su[l-1]
print ‘最大公约数:‘,p
print ‘最小公倍数:‘,a*b/p
时间: 2024-10-08 11:09:58