[Solved] With 3 number print 3 different case


You would have to do something like this as having an else if after an else for the same block will cause you issues. If this is not the behavior you are looking for please supply more info and I’ll try to help 🙂

int a, b, c;

Scanner scan = new Scanner(System.in);
System.out.println("Inserire a");
a = scan.nextInt();
System.out.println("Inserire b");
b = scan.nextInt();
System.out.println("Inserire c");
c = scan.nextInt();

if (a == b && a == c){
     System.out.println("All the same");
}

else if (((a==b) && b!=c) || ((a==c) && (b!=c)) || ((b == c) && (a!= c)));
{
    System.out.println("Two the same and one different ");
}
else 
{
    System.out.println("Tutti diversi");
    System.out.print(" All different");
}

4

solved With 3 number print 3 different case