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:
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?
Show a friend, family member, or teacher what you've done!
Here is a share link to your code:
Does your code work? Want to run it on your iPhone?
Here's your code:
Use [Control]-[C] (Windows) or [⌘]-[C] (MacOS) to copy your code.
Paste it using [Control]-[V] (Windows) or [⌘]-[V] (MacOS) into
Then click the "Use on iPhone" button that you'll see.