编程C语言,输入3个数,按由大到小顺序输出
来源:百度知道 编辑:UC知道 时间:2024/05/12 16:39:47
#include "stdio.h"
main()
{
int a,b,c,t;
scanf("%d,%d,%d",&a,&b,&c);
if(a<b)
{t=a;a=b;b=t;}
if(a<c)
{t=a;a=c;c=t;}
if(b<c)
{t=b;b=c;c=t;}
printf("%d,%d,%d",a,b,c);
getchar();
getchar();
}
不好意思,好久不用了都不会了
方法很多的
是初级的还是高级的
http://zhidao.baidu.com/question/13796094.html
这个是四个的
你稍微改下就好了
简单版:
#include <stdio.h>
main()
{
int a,b,c,max;
scanf("%d%d%d",&a,&b,&c);
max=(a<b)?((b<c)?c:b):((a<c)?c:a);
printf("%d\n",max);
}