编写函数求三个数的最大值,在主函数中输入任意三个数通过调用该函数来求最大值

求详细过程

/*求任意三个数的最大值*/
#include <stdio.h>

int main()
{
int a=0;
int b=0;
int c=0;
int max=0;
printf("请输入任意三个数:");
scanf("%d,%d,%d",a,b,c);
max=a;
if(max<b)
{
max=b;
}
if(max<c)
{
max=c;
}
printf("max=%d\n",max);
return 0;
}追问

显示出错啊

温馨提示:答案为网友推荐,仅供参考
第1个回答  2014-06-12
int funMax(int a,int b,int c)
{
if(a > b && a > c)

return a;

else if(b > a && b > c)

return b;

else if(c > a && c > b)

return c;

else

return -1;

}
相似回答