Olivia likes triangles. Hence, John decided to give her three integers and ask whether a triangle with edge length as given three integers is possible.
Help Olivia in answering it.
Input
The input consists of a single line containing three space-separated integers A, B, and C.
Constraints
1 <= A, B, C <= 100
Output
Output “Yes” if the triangle is possible otherwise, “No” (without quotes).
Example
Sample Input 1:
5 3 4
Sample Output 1:
Yes
Sample Explanation 1:
The possible triangle is a right-angled triangle with a hypotenuse of 5.
Solution
import java.io.*; // for handling input/output
import java.util.*; // contains Collections framework
// don't change the name of this class
// you can add inner classes if needed
class Main {
public static void main (String[] args) {
// Your code here
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int b = sc.nextInt();
int c = sc.nextInt();
if (a + b > c && a + c > b && b + c > a) {
System.out.println("Yes");
// sauravhathi
} else {
System.out.println("No");
}
}
}Happy Learning – If you require any further information, feel free to contact me.
![[Solved] The Love Triangle CodeCrush by NewtonSchool [Solved] The Love Triangle CodeCrush by NewtonSchool](https://realcoder.techss24.com/wp-content/uploads/2023/02/Solved-The-Love-Triangle-CodeCrush-by-NewtonSchool.png)
![[Solved] The megastore offers a deal that states any product whose price is a golden price O would be given to them for free](https://realcoder.techss24.com/wp-content/uploads/2022/12/Solved-The-megastore-offers-a-deal-that-states-any-product-whose-price-is-a-golden-price-O-would-be-given-to-them-for-free-300x196.png)
![[Solved] Count Integers Number of Different Integers in a String](https://realcoder.techss24.com/wp-content/uploads/2022/12/Solved-Count-Integers-Number-of-Different-Integers-in-a-String-300x195.png)
![[Solved] Pet Store STARTERS 71 CodeChef](https://realcoder.techss24.com/wp-content/uploads/2022/12/Solved-Pet-Store-STARTERS-71-CodeChef-300x197.png)