Advertisement
hkshakib

Untitled

Jul 15th, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int gcd(long long a,long long b)
  5. {
  6. if (b == 0)
  7. return a;
  8. else
  9. return gcd (b, a % b);
  10. }
  11. int main()
  12. {
  13. int n;
  14. cin>>n;
  15. while(n--)
  16. {
  17. long long a,b;
  18. cin>>a>>b;
  19. long long c=(a*b)/gcd(a,b);
  20. cout<<gcd(a,b)<<" "<<c<<endl;
  21. }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement