1. 程式人生 > >三個數比較大小(非陣列)

三個數比較大小(非陣列)

public static void sort(int a,int b,int c)     {          if (a > b) {                 if (c > a) {                     System.out.println(b + "," + a + "," + c);                 } else if (c < b) {                     System.out.println(c + "," + b + "," + a);                 } else {                     System.out.println(b+","+c+","+a);                 }

                             // a<<b時                 }else {                 if(c<a){                     System.out.println(c+","+a+","+b);                 }else if(c>b){                     System.out.println(a+","+b+","+c);                 }else{                     System.out.println(a+","+c+","+b);                 }             }

    }

--------------------- 本文來自 pxl20171799 的CSDN 部落格 ,全文地址請點選:https://blog.csdn.net/pxl20171799/article/details/82860365?utm_source=copy