C语言-求最大值

#include<stdio.h>
void main() 
{int a,b,c,d; 
scanf("%d,%d,%d",&a,&b,&c); 
d=max(a,b,c); 
printf("max=%d",d); 
getch(); /*暂停看运行结果*/ 
} 
int max(int x,int y,int z)
{int u; 
if(x>=y&&x>=z) 
u=x; 
else if(y>=x&&y>=z) 
u=y; 
else 
u=z; 
return(u); 
}
View Code

猜你喜欢

转载自www.cnblogs.com/lovebing/p/9157790.html