LCM in C Plus Plus

Lowest Common multiples are multiples that two numbers have in common. Division of integers by zero is undefined, this definition has meaning only if a and b are both different from zero. These can be useful when working with fractions and ratios. There are two ways of finding the lowest common multiple of two numbers.

The first way to find the lowest common multiple, write out a list of the lowest multiples of each number, and look for the lowest multiple both numbers have in common.

The other way to find the lowest common multiple is to list the prime factors for each number. Remove the prime factors both numbers have in common. Multiply one of the numbers by the remaining prime factors of the other number. The result will be the lowest common multiple.

Click here to find Lowest common multiple of two number in C++