7-19 sdut-最大公约数和最小公倍数

def gcd(a,b):
    if a%b == 0:
        return b
    else :
        return gcd(b,a%b)


while 1:
    try:
        a, b = map(int, input().split())
        ma=gcd(a,b)
        print("{} {}".format(ma,int(a*b/ma)))
    except:
        break

posted @ 2022-05-25 21:30  kingwzun  阅读(192)  评论(0编辑  收藏  举报