首页 > 编程语言 > 详细

C语言-实例3个数由小到大排序

时间:2019-06-05 22:50:05      阅读:112      评论:0      收藏:0      [点我收藏+]
 1     VS2012
 2     
 3     //C语言实例 3个数由小到大排序
 4     
 5     #include <stdio.h>
 6         
 7     void main()
 8     {
 9         int a, b, c, t;
10         printf("Please input a,b,c;\n");
11         scanf("%d%d%d", &a, &b, &c);
12         if (a > b)
13         {
14             t = a;
15             a = b;
16             b = t;
17         }
18     
19         if (a > c)
20         {
21             t = a;
22             a = c;
23             c = t;
24         }
25 
26         if (b > c)
27         {
28             t = b;
29             b = c;
30             c = t;
31         }
32 
33         printf("The order of the number is:\n");
34         printf("%d,%d,%d", a, b, c);
35     }

技术分享图片

C语言-实例3个数由小到大排序

原文:https://www.cnblogs.com/nxopen2018/p/10981712.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!