My program is designed to accept 3 lengths (inputed directly into the program) and display whether the triangle is equilateral, isosceles, or scalene. When I run it, all of the outputs are displayed. Could someone tell me what's wrong? (I'm using JCreator)
import java.io.*;
public class Triangles
{
public static void main(String [] args)
{
int num1;
int num2;
int num3;
num1 = 3;
num2 = 3;
num3 = 3;
if ((num1 == num2) && (num1 == num3))
{
System.out.println("Your triangle is equalateral, all sides are the same length!");
}
if (((num1 == num2) && (num1 != num3)) || ((num1 == num3) && (num1 != num2)) || ((num2 == num3) && (num2 != num1)));
{
System.out.println("Your triangle is isosceles, two sides are the same length!");
}
if ((num1 != num2) && (num1 != num3) && (num2 != num3));
{
System.out.println ("Your triangle is scalene, no sides are the same length!");
}
if ((((num1 num2)<num3) || ((num2 num3)<num1) || ((num1 num3)<num2)));
{
System.out.println ("Your 'triangle' isn't a triangle!");
}
}
}
Tags: