#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
int comdiv(int a, int b)
{
int r;
while (r = a % b)
{
a = b;
b = r;
}
return b;
}
int main()
{
int N,M;
cin >> N >> M;
cout << "最大公约数:" << comdiv(N, M) << endl;
cout << "最小公倍数:" << N*M/comdiv(N, M) << endl;
system("pause");
return 0;
}
10-01
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交