Initial commit: Python learning project with examples and exercises
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
#最小公倍数
|
||||
a = int(input())
|
||||
b = int(input())
|
||||
|
||||
def _gcd(x,y): #最大公约数
|
||||
if x>y:
|
||||
x,y=y,x
|
||||
for i in range(x,0,-1):
|
||||
if x%i==0 and y%i==0:
|
||||
return i
|
||||
|
||||
def lcm(x,y): #最小公倍数
|
||||
a = int((x*y)/_gcd(x,y))
|
||||
return a
|
||||
|
||||
print(lcm(a,b))
|
||||
Reference in New Issue
Block a user