#include<iostream>
using namespace std;
int main() {
//最大公因数和最小公倍数
int m, n;
cout << "请输入两个整数" << endl;
cin >> m >> n;
int yin(int a, int b);
cout<<"最大公因数是"<<yin(m, n) << endl;
int bei(int a, int b);
cout << "最小公倍数是"<<bei(m, n) << endl;
return 0;
}
int yin(int a, int b) {
int duan(int a, int b);
int max = duan(a, b);
int i = 1, m, n;
for (i = max;i >0;i--) {
m = a % i;
n = b % i;
if (m == 0 && n == 0 )
break;
}
return i;
}
int duan(int a, int b) {
if (a >= b)return a;
else return b;
}
int bei(int a, int b) {
int yin(int a, int b);
return (a * b / yin(a, b));
}