GCD and LCM
Single File Programming Question
Problem Statement
Alex is learning about the greatest common divisor (GCD) and the least common multiple (LCM) in mathematics. He decided to create a GCD class to find the GCD and LCM of two numbers. Write a program to find GCD and LCM using classes and objects.
Input:
format :The first line of input contains an integer 'a' representing the first number.
The second line of input contains an integer 'b' representing the second number.
Output:
format :The first line of output prints "GCD: " followed by an integer representing the gcd of two numbers.
The second line of output prints "LCM: " followed by an integer representing the lcm of two numbers.
Refer to the sample output for format specifications
Code constraints : JAThe given test cases fall under the following constraints:
1 ≤ a, b ≤ 1000
Sample test cases :
Input 1:
4
12
Output 1 :
GCD: 4
LCM: 12
Input 2 :
6
8
Output 2 :
GCD: 2
LCM: 24