Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int gcd(long long a,long long b)
- {
- if (b == 0)
- return a;
- else
- return gcd (b, a % b);
- }
- int main()
- {
- int n;
- cin>>n;
- while(n--)
- {
- long long a,b;
- cin>>a>>b;
- long long c=(a*b)/gcd(a,b);
- cout<<gcd(a,b)<<" "<<c<<endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement