Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Greater {
- public static void main(String[] args) {
- int[] number = new int[5];
- int min = Integer.MAX_VALUE;
- int max = Integer.MIN_VALUE;
- Scanner in = new Scanner(System.in);
- for (int i = 0; i < 5; i++) {
- System.out.print("" + (i + 1) + "個目: ");
- number[i] = in.nextInt();
- if (min > number[i])
- min = number[i];
- if (max < number[i])
- max = number[i];
- }
- for (int i = 0; i < 5; i++)
- if (number[i] > (max - min) / 2.)
- System.out.println(number[i]);
- in.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement