Java
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | import java.util.Scanner; public class Main { static final int LIMIT = 10; public static void main (String[] arg) { Scanner sc = new Scanner(System.in); int[] num = new int[LIMIT]; int max = 0, min = 10000; for (int i=0; i<LIMIT; i++) { num[i] = sc.nextInt(); if (0 < i) { if (num[i] < 100) max = num[i] < max ? max : num[i]; else if (100 <= num[i]) min = min < num[i] ? min : num[i]; } else if (i == 0) { if (num[i] < 100) max = num[i]; else min = num[i]; } } if (max == 0) max = 100; if (min == 10000) min = 100; System.out.print(max + " " +min); } } | cs |