2053:【例3.3】三个数(2053: [example 3.3] three numbers)-其他
2053:【例3.3】三个数(2053: [example 3.3] three numbers)
【题目描述】
输入三个整数,按从大到小的顺序输出。
【输入】
输入三个整数
【输出】
按从大到小的顺序输出。
【输入样例】
3 2 1
【输出样例】
3 2 1
#include <stdio.h>
int 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\n",a,b,c);
return 0;
}
————————
[Title Description]
Enter three integers and output them in descending order.
[input]
Enter three integers
[output]
Output in descending order.
[input example]
3 2 1
[output example]
3 2 1
#include <stdio.h>
int 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\n",a,b,c);
return 0;
}