- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP

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

# How to Find LCM using Python?

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

## Example

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))

## Output

The result is −

LCM of 12 and 20=60

- Related Questions & Answers
- C++ Program to Find LCM
- Find LCM of two numbers
- Java Program to 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++
- 8085 Program to compute LCM
- C++ Program to Find the GCD and LCM of n Numbers
- How to find time difference using Python?
- How to find keith numbers using Python?
- How to find a file using Python?
- Find the longest subsequence of an array having LCM at most K in Python
- Find any pair with given GCD and LCM in C++
- How to Find Hash of File using Python?

Advertisements