29 - Write a program in Python to computer the least common multiple of two integers.
import math
a=int(input("Enter first number: "))
b=int(input("Enter second number: "))
print("LCM of ",a,"and",b,"=",math.lcm(a,b))
Output:
Enter first number: 5
Enter second number: 7
LCM of 5 and 7 = 35
Enter first number: 8
Enter second number: 12
LCM of 8 and 12 = 24
No comments:
Post a Comment