- Related Questions & Answers
- C++ Program to Find LCM
- Find LCM of two numbers
- Find LCM of rational number in C++
- Java program to find the LCM of two numbers
- Write a C# program to find GCD and LCM?
- Program to find LCM of two Fibonnaci Numbers in C++
- How to find a file using Python?
- How to find time difference using Python?
- How to find keith numbers using Python?
- C++ Program to Find the GCD and LCM of n Numbers
- Find the longest subsequence of an array having LCM at most K in Python
- 8085 Program to compute LCM
- How to Find Factors of Number using Python?
- How to Find HCF or GCD using Python?
- How to Find Hash of File using Python?

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

LCM (Least common multiple) of two (or more) numbers is a number which is the smallest number that is divisible by both (or all).

First we find the larger number of two given numbers. Starting from it we try and find the first number that is divisible by both, which is LCM

x=12 y=20 if x > y: greater = x else: greater = y while(True): if((greater % x == 0) and (greater % y == 0)): lcm = greater break greater += 1 print ("LCM of {} and {}={}".format(x,y,lcm))

The result is −

LCM of 12 and 20=60

Advertisements