write a program to find the least common multiple of the given two numbers Mand N
Apply the following set f codes to find the least common multiple:
# Find the L.C.M of two numbers
def lcm(m, n):
"""Returns L.C.M of two numbers."""
if m > n:
z = m
else:
z = n
while True:
if z % m == 0 and z % n == 0:
lcm = z
break
z += 1
return lcm
m = int(input("Enter first number: "))
n = int(input("Enter second number: "))
print("The L.C.M is:", lcm(m, n))
Comments
Leave a comment