#include<bits/stdc++.h> using namespace std; int main(){ int n,m; cin>>n>>m; int temp; int ch=n*m; if(n<m){ temp=n; n=m; m=temp; } int chu=n%m; if(chu==0){ cout<<m<<" "<<ch/m; } else{ while(chu!=0){ n=m; m=chu; chu=n%m; } cout<<m<<" "<<ch/m; } return 0; } |
Double click to view unformatted code.