求助,有关求最大公约数和最小公倍数的
#include <stdio.h>void main()
{
int m,n,t1;
int gcd(int x,int y);
printf("input two integer numbers:\n");
scanf("%d,%d",&a,&b);
t1=gcd(m,n);
printf("The highest common divisor is %d\n",t1);
printf("The lowest common multiple is %d\n",m*n/t1);
}
int gcd(int x,int y)
{
if(x%y==0)
return y;
else
return gcd(y,x%y);
}
其中在定义gcd时,为什么不用比较x y大小,就直接用if语句了??