求最大公约数的程序 谁能告诉我为什么我编译以后结果是错的呢
#include <stdio.h> int main()
{
int gcd(int a,int b);
int a,b,c;
printf("please input two numbers:");
scanf("%d,%d",&a,&b);
c=gcd(a,b);
printf("The greatest common divisor is: %d",c);
system("PAUSE");//结束
return 0;
}
int gcd(int a,int b)
{
int c,d;
if(a<b)
{
c=a;
a=b;
b=c;
}
while((d=a%b)!=0)
{
a=b;
b=d;
}
return b;
}