LCM of two numbers in Python

LCM of two numbers in Python using functions

How to Find Least Common Multiple (LCM) in Python programming language by using the functions?

What is  LCM?

  • LCM stands for Least Common Multiple/ Lowest Common Multiple.
  • LCM is a theory of arithmetic and number system.

How to demote LCM of two numbers?

The LCM of two numbers X and Y can be denoted by LCM (X,Y).

In this example, LCM is the lowest positive number that is divisible by both “X” and “Y”.

Example of LCM

We have two integers 1 and 2. Let’s find LCM

Multiples of 1: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ………and many similar.

Multiples of 2: 2, 4, 6, 8, 10, 12, 14, 16,………and many similar.

Common multiples of 1 and 2 are will be the numbers that are common in both of these.

2,  4, 6,8, 10, ………and many similar.

LCM is the lowest common multiplier so, in this example, we have 2 as an LCM.

Write a Python program to find LCM of two numbers


Please! Enter the first number: 4
Please! Enter the second number: 5
The L.C.M. of 4 and 5 is 20

Prof.Fazal Rehman Shamil (Available for Professional Discussions)
1. Message on Facebook page for discussions,
2. Video lectures on Youtube
3. Email is only for Advertisement/business enquiries.