#include<bits/stdc++.h> using namespace std; int res(int a,int b){ return b==0?a:res(b,a%b); } int main(){ int a,b; cin>>a>>b; cout<<a*b/res(a,b)<<" "<<res(a,b); return 0; }
Double click to view unformatted code.