#K46552. GCD and LCM Calculation
GCD and LCM Calculation
GCD and LCM Calculation
Given two positive integers a and b, your task is to compute their greatest common divisor (GCD) and least common multiple (LCM). The formulas are given below:
\(\gcd(a,b)\) is the largest integer that divides both a and b without leaving a remainder.
The LCM is computed as:
\[ \text{lcm}(a,b) = \frac{a \times b}{\gcd(a,b)} \]
You need to read the two integers from standard input and output the GCD and LCM separated by a space.
inputFormat
The input consists of a single line containing two positive integers a and b (separated by space).
outputFormat
Output a single line containing two integers: the GCD and the LCM of the given numbers, separated by a space.
## sample15 20
5 60