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

TOP

返回列表