mian()
{
printf("The gcd of 75 and 101 is %d\n",gcd(75,101));
printf("The gcd of 1026 and 405 is %d\n",gcd(1026,405));
printf("The gcd of 91 and 13 is %d\n",gcd(91,13));
}
gcd(a,b)
int a,b;
{
int temp;
while (b!=0)
{
temp=a%b;
a=b
b=temp;
}
return a;
}
结果:
The gcd of 75 and 101 is 1
The gcd of 1026 and 405 is 27
The gcd of 91 and 13 is 13
我是个初初初初初学者``解释得越详细越好``
谢谢