Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.javarush.test.level04.lesson16.home02;
- import java.io.*;
- /* Среднее такое среднее
- Ввести с клавиатуры три числа, вывести на экран среднее из них. Т.е. не самое большое и не самое маленькое.
- */
- public class Solution
- {
- public static void main(String[] args) throws Exception
- {
- BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
- int a, b, c;
- a = Integer.parseInt(reader.readLine());
- b = Integer.parseInt(reader.readLine());
- c = Integer.parseInt(reader.readLine());
- if (a > b && a < c || a < b && a > c)
- System.out.println(a);
- else if (b > c && b < a || b < c && b > a)
- System.out.println(b);
- else if (c > a && c < b || c < a && c > b)
- System.out.println(c);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement