Greatest Common Divisor and Least Common Multiple
InterviewTime limit1sMemory limit128 MB
Given two natural numbers up to 10000, output their greatest common divisor and least common multiple.
- Level
Easy2 of 10
- Topics
- Math, Number theory
- Solved
- No attempts yet
Problem
Write a program that finds the greatest common divisor and least common multiple of two natural numbers.
Input
The first line contains two natural numbers A and B separated by a space. A and B are each at most 10,000.
Output
Print the greatest common divisor of A and B on the first line, and print the least common multiple of A and B on the second line.