最大公因数
#include<stdio.h>
int main()
{
int number, x, y, num1, num2, sum, count=1;
scanf("%d\n", &number);
scanf("%d %d\n", &x, &y);
while(count<=number)
{
if(x>y)
{
num1=x;
num2=y;
sum=num1%num2;
while(sum!=0)
{
num1=y;
num2=sum;
sum=num1%num2;
}
printf("%d %d\n", num2, x*y/num2);
}
else
{
num1=y;
num2=x;
sum=num1%num2;
while(sum!=0)
{
num1=y;
num2=sum;
sum=num1%num2;
}
printf("%d %d\n", num2, x*y/num2);
}
scanf("%d %d\n", &x, &y);
count++;
}
return 0;
}