返回列表 發帖
  1. import java.io.Console;

  2. public class ch17


  3. {
  4.   public static void main (String args[])
  5.   {
  6.       int a,b,c,d,e,f,g,bigger;
  7.       Console console=System.console();
  8.       System.out.print("請輸入第1個數: ");
  9.       a=Integer.parseInt(console.readLine());
  10.       System.out.print("請輸入第2個數: ");
  11.       b=Integer.parseInt(console.readLine());
  12.       System.out.print("請輸入第3個數: ");
  13.       c=Integer.parseInt(console.readLine());
  14.       System.out.print("請輸入第4個數: ");
  15.       d=Integer.parseInt(console.readLine());
  16.       e=(a>b)?a:b;
  17.       f=(c>d)?c:d;
  18.       bigger=(e>f)?e:f;
  19.       System.out.print("四數中較大的數為:"+bigger);


  20.   }
  21. }
複製代碼

TOP

返回列表