/* -------------------------------------------------- 3個の数字を並べて表示 If_09_sort2 -------------------------------------------------- */ import java.io.*; class If_09_sort2 { public static void main(String[] args) throws Exception { BufferedReader inp=new BufferedReader (new InputStreamReader(System.in)); String keybd; int a,b,c,w; System.out.print("数字を3個入力してください\n"); System.out.print("aはいくつ?"); keybd=inp.readLine(); a=Integer.parseInt(keybd); System.out.print("bはいくつ?"); keybd=inp.readLine(); b=Integer.parseInt(keybd); System.out.print("cはいくつ?"); keybd=inp.readLine(); c=Integer.parseInt(keybd); // a>bならばaとbを入れ替える if ( a>b ) { w=a; a=b; b=w; } // b>cならばbとcを入れ替える if ( b>c) { w=b; b=c; c=w; } // a>bならばaとbを入れ替える if ( a>b ) { w=a; a=b; b=w; } System.out.print("\n小さい方から表示します\n"); System.out.print(a+" "+b+" "+c); System.out.print("\n"); } }