Всем привет. Не могу понять, почему последнее требование: "Если два числа из трех равны, вывести любое из двух." не выполняется, если в input выводится правильное значение. Подскажите, в чем может быть проблема?
package com.javarush.task.jdk13.task04.task0441;
import java.io.BufferedReader;
import java.io.InputStreamReader;
/*
Среднее такое среднее
*/
public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader reader = new BufferedReader (new InputStreamReader(System.in));
int a = Integer.parseInt(reader.readLine());
int b = Integer.parseInt(reader.readLine());
int c = Integer.parseInt(reader.readLine());
if ((a & b) == c) {
System.out.println(a);
} else if ((a == c) & (a != b)) {
System.out.println(a);
} else if ((a == b) & (a != c)) {
System.out.println(b);
} else if ((b == c) & (b != a)) {
System.out.println(c);
} else if ((a <= b) & (b <= c)) {
System.out.println(b);
} else if ((b <= a) & (a <= c)) {
System.out.println(a);
} else if ((b <= c) & (c <= a)) {
System.out.println(c);
} else if ((c <= b) & (b <= a)) {
System.out.println(b);
} else if ((c <= a) & (a <= b)) {
System.out.println(a);
} else if ((a <= c) & (c <= b)) {
System.out.println(c);
}
}
}