- import java.lang.*;
- import java.io.Console;
- public class ch18
- {
- public static void main(String args[])
- {
- Console console=System.console();
- int a,b,c,d,bigger,biggerE,biggerF;
- System.out.print("請輸入第一個字串: ");
- a=Integer.parseInt(console.readLine());
- System.out.print("請輸入第二個字串: ");
- b=Integer.parseInt(console.readLine());
- System.out.print("請輸入第二個字串: ");
- c=Integer.parseInt(console.readLine());
- System.out.print("請輸入第二個字串: ");
- d=Integer.parseInt(console.readLine());
- biggerE=(a>b)?a:b;
- biggerF=(c>d)?c:d;
- bigger=(biggerE>biggerF)?biggerE:biggerF;
- System.out.println("您剛輸入最大數為: "+bigger);
- }
- }
複製代碼 |