package com.codegym.task.task04.task0441;
/*
Somehow average
*/
import java.util.Scanner;
public class Solution {
public static void main(String[] args) throws Exception {
Scanner scanner = new Scanner(System.in);
System.out.println("Enter the three numbers: ");
int a = scanner.nextInt();
int b = scanner.nextInt();
int c = scanner.nextInt();
if ( (a - b) * (c - a) >= 0 ) // a >= b and a <= c OR a <= b and a >= c
System.out.println(a);
else if ( (b - a) * (c - b) >= 0 ) // b >= a and b <= c OR b <= a and b >= c
System.out.println(b);
else
System.out.println(c);
}
}
package com.codegym.task.task04.task0441;
/*
Somehow average
*/
import java.util.Scanner;
public class Solution {
public static void main(String[] args) throws Exception {
Scanner scanner = new Scanner(System.in);
System.out.println("Enter the three numbers: ");
int a = scanner.nextInt();
int b = scanner.nextInt();
int c = scanner.nextInt();
if ( (a - b) * (c - a) >= 0 ) // a >= b and a <= c OR a <= b and a >= c
System.out.println(a);
else if ( (b - a) * (c - b) >= 0 ) // b >= a and b <= c OR b <= a and b >= c
System.out.println(b);
else
System.out.println(c);
}
}