python--求2个数的最大公约数和最小公倍数,python--公约数,#!/usr/bin/e


#!/usr/bin/env pythondef gongyueshu(m,n):    if m<n:        small = m    else:        small = n    for i in range (small,0,-1):        if m % i == 0 and n %i == 0:            return idef gongbeishu(m,n):    gongyue = gongyueshu(m,n)    return (m*n)/gongyuegong = gongyueshu(m=10, n=3)print gonggongbei = gongbeishu(m=10,n=3)print gongbei#该片段来自于http://byrx.net

评论关闭