Course of Raku / Addendum 🆕 / Working with data / Numbers and mathematics / Exercises

Greatest common divisor and least common multiple

Problem

For the two numbers 24 and 36, print their greatest common divisor and their least common multiple, in the format shown in the example.

Example

The program prints:

gcd = 12
lcm = 72

Solution

See the solution

Course navigation

Solution: Prime factorisation   |   Solution: Greatest common divisor and least common multiple