Advertisement
Azazavr

javarush.test.level04.lesson16.home02

Oct 28th, 2016
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.92 KB | None | 0 0
  1. package com.javarush.test.level04.lesson16.home02;
  2.  
  3. import java.io.*;
  4.  
  5. /* Среднее такое среднее
  6. Ввести с клавиатуры три числа, вывести на экран среднее из них. Т.е. не самое большое и не самое маленькое.
  7. */
  8.  
  9. public class Solution
  10. {
  11.     public static void main(String[] args)   throws Exception
  12.     {
  13.         BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
  14.  
  15.         int a, b, c;
  16.         a = Integer.parseInt(reader.readLine());
  17.         b = Integer.parseInt(reader.readLine());
  18.         c = Integer.parseInt(reader.readLine());
  19.  
  20.         if (a > b && a < c || a < b && a > c)
  21.             System.out.println(a);
  22.         else if (b > c && b < a || b < c && b > a)
  23.             System.out.println(b);
  24.         else if (c > a && c < b || c < a && c > b)
  25.             System.out.println(c);
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement