Triangle

Report a typo

Given three natural numbers A, B, and C. Determine if a triangle with these sides can exist.

If the triangle exists, output the "YES" string; otherwise, output "NO".

A triangle is valid if the sum of its two sides is greater than the third side. If three sides are A, B, and C, then three conditions should be met.

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

triangle

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