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

  3. public class Ch06 {
  4.     public static void main(String args[]) {
  5.     while(true)
  6.     {
  7.         int a,b,c,d,e;
  8.         Scanner s=new Scanner(System.in);
  9.         System.out.print("請依序輸入四個數: ");
  10.         a=s.nextInt();
  11.         b=s.nextInt();      
  12.         c=s.nextInt();
  13.         d=s.nextInt();               
  14.         e=a>b?a:b;        
  15.         e=e>c?e:c;        
  16.         e=e>d?e:d;
  17.         System.out.println("最大的數為:"+e);
  18.         
  19.     }
  20.             
  21.    
  22.             
  23.    
  24.    
  25.    
  26.    
  27.    
  28.     }

  29. }
複製代碼

TOP

返回列表