C语言实验——从大到小输出a、b、c(选择结构)

来源:互联网 发布:软件故障处理要求 编辑:程序博客网 时间:2024/06/09 20:45

Problem Description

从键盘输入三个整数a、b、c,要求将输出的数据按从大到小排序后输出。

Input

从键盘上输入三个整数a、b、c,每个整数之间用空格分开。

Output

从大到小顺序输出a、b、c的值。

Example Input

4 3 5

Example Output

5 4 3



#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",a,b,c);
return 0;
}

0 0
原创粉丝点击