All tasks
Mediummath

GCD and LCM

Time limit 2 s · Memory 64 MBAcceptance: —Solved by: 0

Statement

One line contains two positive integers a and b. Print their greatest common divisor (GCD) and least common multiple (LCM) separated by a space.

Examples

Example 1
Input
12 18
Output
6 36
Example 2
Input
7 13
Output
1 91

Constraints

  • 1 ≤ a, b ≤ 10^9
Solve this task to unlock the editorial.

AI tutor

Stuck? Get a nudge — the tutor explains the idea, it never hands you the solution.