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

来源:互联网 发布:黑魂3剧情解析 知乎 编辑:程序博客网 时间:2024/06/02 10:21


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

Time Limit: 1000MS Memory Limit: 65536KB


Problem Description

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


Input

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


Output

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


Example Input

4 3 5


Example Output

5 4 3


Hint

Author









参考代码



#include<stdio.h>int main(){    int a,b,c,temp;    scanf("%d%d%d",&a,&b,&c);    if(a<b)    {        temp = a;        a = b;        b = temp;    }    if(a<c)    {        temp = a;        a = c;        c = temp;    }    if(b<c)    {        temp = b;        b = c;        c = temp;    }    printf("%d %d %d",a,b,c);    return 0;}


0 0
原创粉丝点击