Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class zxc {
- public static void main(String[] args)
- {
- Scanner scn = new Scanner(System.in);
- int[] num = new int[5];
- int temp=0;
- System.out.print("請輸入5個整數:");
- for(int i=0;i<5;i++)
- {
- num[i] = scn.nextInt();
- if(num[i]>temp)
- temp = num[i];
- }
- System.out.printf("最大的數字為%d\n",temp);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement