[Solved] LCM of the Two Numbers


From Wikipedia (https://en.wikipedia.org/wiki/Greatest_common_divisor):

In mathematics, the greatest common divisor (gcd) of two or more integers, which are not all zero, is the largest positive integer that divides each of the integers. For example, the gcd of 8 and 12 is 4.

Using Euclid’s algorithm

Formally the algorithm can be described as:

gcd(a,0)=a

gcd(a,b)=gcd(b,a mod b)

where

a mod b = a – b [ a / b ]

If the arguments are both greater than zero then the algorithm can be written in more elementary terms as follows:

gcd(a,a)=a

gcd(a,b)=gcd(a-b,b), if a > b

gcd(a,b)=gcd(a,b-a), if b > a

solved LCM of the Two Numbers