#include<stdio.h>
int EA(int a,int b) // 欧几里得算法
{
int remainder;
int middle;
if (a < b) // a,b交换值
{
b = a + b;
a = b - a;
b -= a;
}else if(a==b)
{
return a;
}
do
{
remainder = a % b;
if (remainder == 0)return b;
a = b;
b = remainder;
} while (remainder!=0);
return b;
}
int main()
{
int a, b;
scanf("%d%d",&a ,&b);
int c = EA(a,b);
printf("%d",c);
return 0;
}
标签:return,int,欧几里得,EA,最大公约数,除法,remainder
From: https://www.cnblogs.com/JK8395/p/16875598.html