write a program in java to enter three sides of a triangle and check whether a triangle is valid or not.
Answers
Answered by
2
Question:-
Write a program in Java to enter three sides of a triangle and check whether the triangle is valid or not.
Code:-
class IsTrianglePossible
{
public static void main(int a, int b, int c)
{
boolean x=a+b>c,y=b+c>a, z=a+c>b;
if(x&&y&&z)
System.out.println("Triangle is possible.");
else
System.out.println("Triangle is not possible.");
}
}
Similar questions