Assignment in C:
Write an efficient program that gets a list of (positive) integers from the user and then compute their Least Common Multiple (LCM). LCM of k given numbers, denoted in Mathematics as LCM (n1, n2, n3, …, nk), is the smallest (positive) integer that all the numbers n1, n2, …, nk, are their divisors. For example, LCM (2, 2) = 2, LCM (2, 4) = 4, LCM (2, 3, 4) = 12, LCM (2, 5, 8, 10) = 40, etc.
You may assume the user enters all the positive numbers and then 0 to end the input. The user may enter as many numbers as they want.
The program must be efficient.
2007-12-26
16:26:19
·
2 answers
·
asked by
Anonymous
in
Programming & Design