#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
", m);
system("pause");
return 0;
}
运行结果: