#K69382. GCD and LCM Calculator
GCD and LCM Calculator
GCD and LCM Calculator
Given two positive integers a and b, calculate their greatest common divisor (GCD) and least common multiple (LCM). The GCD of two integers is defined as the largest positive integer that divides both of them without leaving a remainder. Mathematically, the GCD is denoted as \(\gcd(a, b)\). The LCM is defined as the smallest positive integer that is a multiple of both a and b and can be computed using the formula:
[ \text{lcm}(a, b)=\frac{|a\times b|}{\gcd(a, b)} ]
Your task is to implement a program that reads the two integers from the standard input, computes the GCD and LCM, and prints the results to the standard output separated by a space.
inputFormat
The input consists of a single line containing two space-separated positive integers a and b.
outputFormat
Output a single line containing two integers: the GCD and the LCM of the input numbers, separated by a space.
## sample4 6
2 12
</p>