python计算最大公约数和最小公倍数

mac2022-06-30  19

a=4 b=2 def gcd(a,b): return a if b==0 else gcd(b,a%b) def lcm(a,b): return a*b//gcd(a,b) print(gcd(a,b))#最大公约数 print(lcm(a,b))#最小公倍数

转载于:https://www.cnblogs.com/c-x-a/p/10023449.html

最新回复(0)