NYOJ41 - 三个数从小到大排序

描述:
现在要写一个程序,实现给三个数排序的功能
输入:
输入三个正整数
输出:
给输入的三个正整数排序

样例输入:
20 7 33
样例输出:
7 20 33

#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;
}         
posted @ 2017-01-25 18:29  gwj1139177410  阅读(107)  评论(0编辑  收藏  举报
选择