Write a program to input two integers and find their Least Common Multiple(L.C.M).
For Example,
INPUT: Enter 2 integers:
12
8
OUTPUT: L.C.M. = 24
Answers
Answered by
2
def gcd(a,b):
if a == 0:
return b
return gcd(b % a, a)
lcm = lambda a, b: (a / gcd(a, b)) * b
a, b = list(map(int, input("enter a, b: ").split()))
print("LCM:", lcm(a, b))
Similar questions