返回列表 發帖
  1. import java.lang.*;
  2. import java.io.Console;
  3. public class ch18
  4. {
  5.    public static void main(String args[])
  6.    {
  7.         Console console=System.console();
  8.         int a,b,c,d,bigger,biggerE,biggerF;
  9.         System.out.print("請輸入第一個字串: ");
  10.         a=Integer.parseInt(console.readLine());
  11.         System.out.print("請輸入第二個字串: ");
  12.         b=Integer.parseInt(console.readLine());
  13.         System.out.print("請輸入第二個字串: ");
  14.         c=Integer.parseInt(console.readLine());
  15.         System.out.print("請輸入第二個字串: ");
  16.         d=Integer.parseInt(console.readLine());
  17.         biggerE=(a>b)?a:b;
  18.         biggerF=(c>d)?c:d;
  19.         bigger=(biggerE>biggerF)?biggerE:biggerF;
  20.         System.out.println("您剛輸入最大數為: "+bigger);
  21.    }
  22. }
複製代碼

TOP

返回列表