#include<stdio.h>
int main()
{
int a=10,b=4; //a为除数,b为被除数
int temp;
while(b) //被除数不为0,商为0
{
temp=a%b;
a=b;
b=temp;
}
printf("%d\n",a); //最后a为两者的最大公约数
}
#include<stdio.h>
int main()
{
int a=10,b=4; //a为除数,b为被除数
int temp;
while(b) //被除数不为0,商为0
{
temp=a%b;
a=b;
b=temp;
}
printf("%d\n",a); //最后a为两者的最大公约数
}