[求助]C的取最大最小问题
#include<stdio.h>main()
{int a,b,c,sum,average,maxnumber,minnumber;
scanf("%d,%d,%d",&a,&b,&c);
sum=a+b+c;
average=sum/3;
maxnumber=MAX(a,b,c);
minnumber=MIN(a,b,c);
printf("%d,%d,%d,%d",sum,average,maxnumber,minnumber);
getch();
}
int MAX(int x,int y,int z)
{ int maxnumber;
if(x>y) maxnumber=x;
else maxnumber=y;
if(x>z) maxnumber=x;
return(maxnumber);
}
int MIN(int x,int y,int z)
{ int minnumber;
if(x<y) minnumber=x;
else minnumber=y;
if(x<z) minnumber=x;
return(minnumber);
}
请问为什么不能得到最大值,却可以得到最小值??
请交各位大侠~~~