728x90
반응형
#include <iostream>
using namespace std;
int gcd=1;
void cal(int b,int a){
while(a!=0){
int t=b%a;
b=a;
a=t;
}
gcd=b;
return;
}
int main()
{
int a,b;
cin>>a>>b;
if(a>b){
cal(a,b);
}
else{
cal(b,a);
}
cout<<gcd<<"\n"<<(a*b)/gcd;
return 0;
}
728x90
반응형