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

TOP

返回列表