项目投资管理案例分析:C 程序编程,用C语言啊,不是C++

来源:百度文库 编辑:查人人中国名人网 时间:2024/05/04 13:15:53
编写一个C程序,输入a,b,c 3个值,输出其中最大者

void main()
{
int a,b,c,tem;
scanf("%d %d %d",&a,&b,&c);
if(a>b)
{
tem=a;
}
else
tem=b;
if(c>tem)
{
tem=c;
}
printf("the number is %d\n",tem);
}
输入一个数点一下空格

max(int a,int b,int c)
{
int temp;
temp=(a>b?a:b);
return(temp>c?temp:c);
}
void main()
{
int a,b,c;
printf("input a,b,c\n");
scanf("%d%d%d");
printf("The max is:\n";max(a,b,c));
}