In this post we discuss a method to find out LCM (least common multiple) of 2 numbers, LCM of 2 numbers is the least number that is divisible by 2 numbers.

for example, if we consider 4 and 5 then their LCM is 20.

Though there are a lot of methods to find LCM of 2 numbers here I will focus on find LCM using GCD of 2 numbers. Consider 'A' and 'B' to be 2 numbers so we calculate LCM by using the below formula

The product of the numbers is equal to the product of their GCD and LCM.

A * B = GCD(A,B) * LCM(A,B)

If you want to know about GCD of 2 numbers then follow my post on GCD Here.

In the following programs, we first find the GCD of 2 numbers and then divide the product of two numbers by the GCD to LCM of the numbers.

C ProgramC++ ProgramJava programPython Program C Program C++ Program Java Program Python Program

for example, if we consider 4 and 5 then their LCM is 20.

Though there are a lot of methods to find LCM of 2 numbers here I will focus on find LCM using GCD of 2 numbers. Consider 'A' and 'B' to be 2 numbers so we calculate LCM by using the below formula

The product of the numbers is equal to the product of their GCD and LCM.

A * B = GCD(A,B) * LCM(A,B)

If you want to know about GCD of 2 numbers then follow my post on GCD Here.

In the following programs, we first find the GCD of 2 numbers and then divide the product of two numbers by the GCD to LCM of the numbers.

C ProgramC++ ProgramJava programPython Program C Program C++ Program Java Program Python Program

**You might also be interested in**

**Anagram Strings****Double Linked List****Finding Middle node in a Linked List****Infix to Prefix Conversion****Infix to Postfix Conversion****Binary Sear…**

**
**