Objective
Create a Python program that calculates the greatest common divisor (GCD) and the least common multiple (LCM) of two numbers.
Instructions
- Read two positive integers, one per line.
- Calculate the GCD with
math.gcd. - Calculate the LCM with the formula
a · b / GCD(use the integer division//). - Show
GCD: Xon the first line andLCM: Yon the second.
12
18
GCD: 6
LCM: 36
Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.
Start exercise