编写一个C程序,输入a,b,c 3个值,输出其中最大者,帮忙编辑下,谢谢

来源:百度知道 编辑:UC知道 时间:2024/05/30 07:40:39

只写函数了哈:主程序省了

int Max(int a , int b , int c)
{
int x;

x = (a+b+abs(a-b))/2; /* 得到a,b中的最大值 */
/* 不要跟我说你不知道 abs()是什么 */
/* 用 abs 前面记得 #include "math.h"*/
if(x>c)
return x;
else
return c;
}

哎,这么简单的程序,怀疑LZ的ZS!

main()
{
double x,y,z,max;
scanf("%lf %lf %lf", &x, &y, &z);
max = x;
if(y > max) max = y;
if(z > max) max = z;
printf("%lf", max);
}