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] Find the Runner-Up Score! HackerRank Problem](https://realcoder.techss24.com/wp-content/uploads/2022/09/Solved-Find-the-Runner-Up-Score-HackerRank-Problem-300x200.png)
![[Solved] Geeta prefers to buy specific items, a 10 percent discount is provided if she buy more than 1200 of them](https://realcoder.techss24.com/wp-content/uploads/2022/09/Solved-Geeta-prefers-to-buy-specific-items-a-10-percent-discount-is-provided-if-she-buy-more-than-1200-of-them-300x200.png)
![[Solved] Lucky Numbers STARTERS 73 CodeChef](https://realcoder.techss24.com/wp-content/uploads/2023/01/Solved-Lucky-Numbers-STARTERS-73-CodeChef-300x200.png)