➤ Problem Link : ENIGMATH
👉 Hint : Think of relation between LCM and GCD of 2 numbers
✅ C++ Solution :
 
#include<bits/stdc++.h>
using namespace std;;
 
#define ll long long int
 
ll gcd(ll a, ll b)
{
    if(b==0)
        return a;
 
    return gcd(b,a%b);
}
 
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        ll a,b;
        cin>>a>>b;
        ll lcm=(a*b)/gcd(a,b);
        ll x=lcm/a;
        ll y=lcm/b;
        cout<<x<<" "<<y<<"\n";
    }
}
Thank you for your patience reading. If you enjoyed this post, I’d be very grateful if you’d help it spread by emailing it to a friend, or sharing it on Whatsapp or Facebook.
😇Happy Learning!!
