How to find LCM in Python

LCM (Least Common Multiple) of two numbers is the smallest number which can be divided by both numbers.
Below is the program to find LCM of two numbers:
# lcm of two numbers a = 7 b = 53 if(a > b): minn = a else: minn = b while(1): if(minn%a == 0 and minn%b == 0): print("LCM is ", minn) break minn += 1
Output:
LCM is 371
Subscribe
Login
Please login to comment
0 Discussion