Created
May 9, 2020 16:19
-
-
Save IAFahim/7713fd07d0b77c4cee044ed9712e794d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main() { | |
int a,aa,b,bb,i,till; | |
scanf("%d",&till); | |
for (int j = 0; j < till; j++) | |
{ | |
scanf("%d %d",&a,&b); | |
if(a<b){ | |
int temp=b; | |
b=a; | |
a=temp; | |
} | |
i=a%b; | |
aa=a;bb=b; | |
while(i!=0) | |
{ | |
aa=bb; | |
bb=i; | |
i=aa%bb; | |
} | |
printf("%d %d\n",bb,a*b/bb); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment