If the past lessons on GCDs (here and here weren't enough for you, we now
turn our attention to the LCM which stands for "least common multiple." The LCM is the smallest number that is a
multiple of two numbers.
We introduce it here because the LCM can be calculated from the GCD using this formula:
$$LCM(a,b)=\frac{a\cdot b}{GCD(a,b)}$$
Now you try. Try completing the LCM function below using GCD function and the formula above.
Type your code here:
See your results here:
This program will not run! You have to fill in the return( ) statement in the function lcm(a,b)
to compute the LCM of two numbers a and b, based on the formula involving the GCD above. Can you do it?
Share your code
Show a friend, family member, or teacher what you've done!