I am trying to make a method that tests to see if 3 lengths can make a triangle. I think i'm making some kind of syntax error but i can't figure out what it is.
Here is the relevant bit of code: (its in java)
public static void trya (int a, int b, int c)
{
if (c>(a+b))
{
System.out.println ("yes") ;
}
else
{
if (b>(a+c))
{
System.out.println ("yes") ;
}
}
else
{
if (a>(b+c))
{
System.out.println ("yes") ;
}
}
else
{
System.out.println ("no") ;
}
}
this is the error message i get:
tryangle.java:17: 'else' without 'if'
else
^