jeudi 27 septembre 2018

Displaying 2 results when only one should display. Java intro

if(first == second || first == third || second == third)
{
    System.out.println("Isosceles Triangle");
}
if(first == second && first == third && second == third)
{
    System.out.println("Equilateral Triangle");
}
if(first != second && first != third && second != third)
    System.out.println("Scalene Triangle");

I want it to where if only 2 sides are equal then Isosceles will be displayed but as of right now it displays both Isosceles and Equilateral when all sides are equal.

Aucun commentaire:

Enregistrer un commentaire