I have implemented:
else if (nr1 == nr2 && nr1 == nr3 && nr2 == nr3)
System.out.println(nr1 + " " + nr2 + " " + nr3);
So if nr1, nr2 and nr3 will be the same it should show: nr1 + nr2 + nr3 but somehow it does not work. Can you explain me why and how to fix it?
Thanks
package pl.codegym.task.task04.task0417;
/*
Masz parę?
*/
import java.io.*;
public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
int nr1 = Integer.parseInt(reader.readLine());
int nr2 = Integer.parseInt(reader.readLine());
int nr3 = Integer.parseInt(reader.readLine());
if (nr1 == nr2)
System.out.println(nr1 + " " + nr2);
else if (nr1 == nr3)
System.out.println(nr1 + " " + nr3);
else if (nr2 == nr3)
System.out.println(nr2 + " " + nr3);
else if (nr1 == nr2 && nr1 == nr3 && nr2 == nr3)
System.out.println(nr1 + " " + nr2 + " " + nr3);
}
}