write a java program to test whether three given sides of a triangle can make a right triangle or not (use ternary operator).
Answers
Answered by
0
Explanation:
// Java program to check
// validity of any triangle
public class loveme {
// Function to calculate for validity
public static int checkValidity(int a, int b, int c)
{
// check condition
if (a + b <= c || a + c <= b || b + c <= a)
return 0;
else
return 1;
}
public static void main(String args[])
{
int a = 7, b = 10, c = 5;
String msg = ((checkValidity(a, b, c)) == 1) ? "Valid" : "Invalid";
System.out.print(msg);
}
}
Similar questions