Common Ground (Math)

Read two positive integers and print their GCD and LCM as gcd lcm.

Input: Two integers up to 10^9.

Output: gcd lcm.

Difficulty: Easy. Write your answer in the browser editor, run the examples, then submit it against hidden tests. Python and JavaScript are free; other languages are part of licode Club.

Hint

  • Euclid: gcd(a, b) = gcd(b, a mod b).

More Math practice