Search across blog, articles, projects, courses, and community posts
The greatest common divisor (GCD) of two numbers is the largest number dividing both. The least common multiple (LCM) is the smallest positive number both divide. Read two integers and print their GCD and LCM.
Input: a b on one line.
Output: gcd lcm, separated by a space.
1 <= a, b <= 10^6
12 18
6 36
7 13
1 91