1 #include<stdio.h> 2 int main() 3 { 4 int a,b,c,n,t; 5 scanf("%d",&n); 6 while(n--) 7 { 8 scanf("%d%d",&a,&b); 9 c=a*b; 10 while(b) 11 { 12 t=b; 13 b=a%b; 14 a=t; 15 } 16 printf("%d %d ",t,c/t); 17 } 18 return 0; 19 }
1 #include<stdio.h> 2 int main() 3 { 4 int a,b,c,n,t; 5 scanf("%d",&n); 6 while(n--) 7 { 8 scanf("%d%d",&a,&b); 9 c=a*b; 10 while(b) 11 { 12 t=b; 13 b=a%b; 14 a=t; 15 } 16 printf("%d %d ",t,c/t); 17 } 18 return 0; 19 }