Java //手动输入3个数,并从小到大排序

 1  //手动输入3个数,并从小到大排序
 2         //import java.util.Sanner;
 3        
 4         System.out.println("请输入第一个数:");
 5         Scanner sc = new Scanner(System.in);
 6         int upSort1 = sc.nextInt();
 7         System.out.println("upSort1 = "+upSort1);
 8         
 9         System.out.println("请输入第二个数:");
10         int upSort2 = sc.nextInt();
11         System.out.println("upSort2 = "+upSort2);
12        
13         System.out.println("请输入第三个数:");
14         int upSort3 = sc.nextInt();
15         System.out.println("upSort3 = "+upSort3);
16         
17         
18         if(upSort1 >=upSort2 )
19         {
20             if(upSort1 <= upSort3)
21             {
22                 System.out.println(upSort2+","+upSort1+","+upSort3);
23             }
24             else if(upSort3 <= upSort2) 
25             {
26                 System.out.println(upSort3+","+upSort2+","+upSort1);
27             }
28             else
29             {
30                 System.out.println(upSort2+","+upSort3+","+upSort1);
31             }
32             
33         }
34         else
35         {
36             if(upSort2<=upSort3)
37             {
38                 System.out.println(upSort1+","+upSort2+","+upSort3);
39             }
40             else if(upSort1>= upSort3)
41             {
42                 System.out.println(upSort3+","+upSort1+","+upSort2);
43             }
44             else
45             {
46                 System.out.println(upSort1+","+upSort3+","+upSort2);
47             }
48         }

Java   //手动输入3个数,并从小到大排序

 

Java //手动输入3个数,并从小到大排序

上一篇:Python之旅 1·Python服务器


下一篇:SpringBoot如何默认引入Tomcat,并自动装配