返回列表 發帖
  1. import java.util.Scanner;
  2. public class Ch01
  3. {
  4.         public static void main(String[] args)
  5.         {
  6.            while(true)
  7.            {
  8.                
  9.                 int a,b,c,d,e,f,g;
  10.             Scanner s=new Scanner(System.in);
  11.             System.out.print("請依序輸入四個數");
  12.             a=s.nextInt();
  13.             b=s.nextInt();
  14.             c=s.nextInt();
  15.             d=s.nextInt();
  16.             e=a>b?a:b;
  17.             f=c>d?c:d;
  18.             g=e>f?e:f;
  19.             System.out.println("最大的數是:"+g);
  20.            }
  21.             
  22.             
  23.                
  24.         }

  25. }
複製代碼

TOP

返回列表