roblem Description
输入两个正整数,求它们的最大公约数与最小公倍数。
Input
输入两个正整数,两个整数之间用空格分开。
数据保证在 int 范围内。
Output
第一行输出最大公约数;
第二行输出最小公倍数。
答案保证在 int 范围内。
Sample Input
64 48
Sample Output
16
192
Hint
Source
#include
using namespace std;
int main(){
int a,b,i,h,n1,n2;
cin>>a>>b;
if(a>b){
h=a;
a=b;
b=h;
}
for (i=1;i<=a;i++){
if(a%i==0 && b%i==0)
n1=i;
}
n2=a*b/n1;
cout<<n1<<endl<<n2<<endl;
}