- import java.lang.System;
- import java.util.Scanner;
- public class Ch06 {
- public static void main(String args[]) {
- while(true)
- {
- int a,b,c,d,e;
- Scanner s=new Scanner(System.in);
- System.out.print("請依序輸入四個數: ");
- a=s.nextInt();
- b=s.nextInt();
- c=s.nextInt();
- d=s.nextInt();
- e=a>b?a:b;
- e=e>c?e:c;
- e=e>d?e:d;
- System.out.println("最大的數為:"+e);
-
- }
-
-
-
-
-
-
-
-
- }
- }
複製代碼 |