Triangle

Report a typo

Given three natural numbers A, B, and C, a triangle with these sides can exist only if it satisfies these conditions:

1. A + B > C
2. A + C > B
3. B + C > A

Basically, a triangle is valid only if the sum of its two sides is greater than the third side.

triangle

Write a program that takes three integer inputs and evaluates if the triangle exists. If a triangle can be constructed using the three numbers, then output the "YES" string; otherwise, output "NO".

Sample Input 1:

3
4
5

Sample Output 1:

YES
Write a program in Java 17
import java.util.Scanner;

class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
// start coding here
}
}

Create a free account to access the full topic