代码
int main()
{
int m = 24;
int n = 18;
int r = 0;
scanf("%d%d", &m, &n);
while (m%n)//辗转相除法
{
r = m%n;
m = n;
n = r;
}
printf("%d\n", n);
return 0;
}
代码
int main()
{
int m = 24;
int n = 18;
int r = 0;
scanf("%d%d", &m, &n);
while (m%n)//辗转相除法
{
r = m%n;
m = n;
n = r;
}
printf("%d\n", n);
return 0;
}