输出老是答案错误,想参考一下。#include <stdio.h>
int gcd( int x, int y );
int main()
{
int x, y,n;
while(scanf("%d%d", &x,&y)!=EOF){
n=x*y/gcd(x,y);
printf("%d %d\n",gcd(x, y),n);}
return 0;
}
int gcd( int x, int y ){
int f=1;
while(f!=0){
f=y%x;
y=x;
x=f;
}
return y;
}