...

/

Finding the Least Common Multiple

Finding the Least Common Multiple

Learn to find the least common multiple for two numbers in Ruby.

Problem

Write a program that asks the user to enter two non-negative integers and finds their least common multiple (LCM).

The least common multiple (LCM) is the smallest non-zero number, which is a multiple of two or more numbers. For example, 1212 is the least common multiple of 66 and 44, as 12=6×212 = 6 \times 2 ...