返回列表 發帖
  1. import java.util.Scanner;

  2. public class Ch09 {

  3.     public static void main(String[] args) {
  4.         while(true)
  5.         {
  6.             Scanner s=new Scanner(System.in);
  7.             int a, b, c, d, e, f, g;
  8.             System.out.print("輸入4個數: ");
  9.             a=s.nextInt();
  10.             b=s.nextInt();
  11.             c=s.nextInt();
  12.             d=s.nextInt();
  13.             e=a>b?a:b;
  14.             f=c>d?c:d;
  15.             g=e>f?e:f;
  16.             System.out.println("4個數中最大為: "+g);
  17.         }
  18.     }
  19. }
複製代碼

TOP

返回列表