三个数从小到大排序

描述

现在要写一个程序,实现给三个数排序的功能

输入
输入三个正整数
输出
给输入的三个正整数排序
样例输入
20 7 33
样例输出
7 20 33
 1 #include <stdio.h>
 2 
 3 int main(){
 4     int a;
 5     int b;
 6     int c;
 7     int temp;
 8     
 9     scanf("%d%d%d",&a,&b,&c);
10     
11     if(a>b){
12         temp=a;
13         a=b;
14         b=temp;
15     }
16     
17     if(a>c){
18         temp=a;
19         a=c;
20         c=temp;
21     }
22     
23     if(b>c){
24         temp=b;
25         b=c;
26         c=temp;
27     }
28     
29     printf("%d %d %d
",a,b,c);     
30         
31     return 0;
32 }
原文地址:https://www.cnblogs.com/zqxLonely/p/4096210.html