Given two positive integers x and y, compute their greatest common divisor (GCD) and least common multiple (LCM). The GCD of two numbers is the largest positive integer that can divide the numbers without a reminder. The LCM of two numbers is the smallest positive integer that can be divided by the two numbers without a reminder.
For example, if x=15 and y=50, you should print:
5 150
since the GCD of 15 and 50 is 5, and the LCM of 15 and 50 is 150.
HINT : You can modify this sample code and implement the function 'gcd' and 'lcm'
#include <stdio.h>
int gcd(int a,int b);
int lcm(int a,int b);
int main(void)
{
int x,y;
scanf("%d %d",&x,&y);
printf("%d %d",gcd(x,y),lcm(x,y));
return 0;
}
Two positive integer x and y, where 0<x,y<5000.
GCD and LCM of x and y, which are separated by a space.
Note that you DO NOT need to print ‘\n’ at the end of the output.