嵌套if语句

如何利用嵌套if来实现3个数从小到大的排序

LUJason
浏览 883回答 1
1回答

OneKi

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);     }          }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);     } }
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java