In This python program we will count LCM using GCD for two inputs.

The least common multiple (L.C.M) of two number is basically the smallest positive integer that is perfectly divisible by the two given number.

lets see an example for 3 and 4:

Multiples of 3:
0, 3, 6, 9, 12, 15, 18, 21, 24...

Multiples of 4:
0, 4, 8, 12, 16, 20, 24, 28....

The LCM of 3 and 4 is 12.
Because 12 is the smallest number (not zero) that is multiple of both.

Here we have two function find_gcd() and find_lcm(). So find_lcm() calls the function find_gcd() to calculate GCD then will calculate lcm. That means the multiple of two value will be floor divide by their GCD value. That will be our answer.

To know more about GCD you can check :


$ python 

Sample Input


Sample Output

LCD: 12

if you got any better solution please share with me in the comment bellow.

Thank you.