import math
def lcm(x, y):
return (x * y) // math.gcd(x, y)
num1, num2 = 12, 18
lcm_result = lcm(num1, num2)
print(f"LCM of {num1} and {num2}: {lcm_result}")Output:
LCM of 12 and 18: 36
import math
def lcm(x, y):
return (x * y) // math.gcd(x, y)
num1, num2 = 12, 18
lcm_result = lcm(num1, num2)
print(f"LCM of {num1} and {num2}: {lcm_result}")Output:
LCM of 12 and 18: 36