辗转相减求最大公约数
#include <iostream>
int main()
{
using namespace std;
int m, n;
cin >> n >> m;
while (m != n)
{
while (m>n) { m = m - n; }
while (n>m) { n = n - m; }
}
printf("%d\n", m);
system("pause");
return 0;
}
运行结果: