mardi 27 octobre 2015

How do I make this input work for 3 sides of a triangle in Java?

This is my first time posting here. I am trying to learn Java and I do not get why this is not working. Any help would be much appreciated!

//Question 5

System.out.println("Enter side A");
sideA = input.nextInt();

System.out.println("Enter side B");
sideB = input.nextInt();

System.out.println("Enter side C");
sideC = input.nextInt();

if(sideA < sideC)
{
  if(sideB < sideC)
  {
    if(sideA + sideB > sideC)
    {
      System.out.println("It is a triangle!");
    }
  }
}

} }

Aucun commentaire:

Enregistrer un commentaire