Advertisement
cd62131

Greater

Aug 2nd, 2014
494
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5 0.60 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Greater {
  4.   public static void main(String[] args) {
  5.     int[] number = new int[5];
  6.     int min = Integer.MAX_VALUE;
  7.     int max = Integer.MIN_VALUE;
  8.     Scanner in = new Scanner(System.in);
  9.     for (int i = 0; i < 5; i++) {
  10.       System.out.print("" + (i + 1) + "個目: ");
  11.       number[i] = in.nextInt();
  12.       if (min > number[i])
  13.         min = number[i];
  14.       if (max < number[i])
  15.         max = number[i];
  16.     }
  17.     for (int i = 0; i < 5; i++)
  18.       if (number[i] > (max - min) / 2.)
  19.         System.out.println(number[i]);
  20.     in.close();
  21.   }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement