Given three sides, check whether triangle is valid or not.
Input : a = 7, b = 10, c = 5 Output : Valid Input : a = 1 b = 10 c = 12 Output : Invalid
Approach: A triangle is valid if 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
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Check whether right angled triangle is valid or not for large sides
- Check whether the triangle is valid or not if angles are given
- Check whether triangle is valid or not if three points are given
- Number of triangles formed by joining vertices of n-sided polygon with two common sides and no common sides
- Count right angled triangles in a matrix having two of its sides parallel to sides of the matrix
- Check whether Quadrilateral is valid or not if angles are given
- Check whether a given point lies inside a triangle or not
- Find all sides of a right angled triangle from given hypotenuse and area | Set 1
- Find area of triangle if two vectors of two adjacent sides are given
- Find the hypotenuse of a right angled triangle with given two sides
- Find the type of triangle from the given sides
- Length of remaining two sides of a Triangle from a given side and its adjacent angles
- Find the length of the median of a Triangle if length of sides are given
- Find other two sides of a right angle triangle
- Find other two sides and angles of a right angle triangle
- Area of Triangle using Side-Angle-Side (length of two sides and the included angle)
- Check if the given chessboard is valid or not
- Program to check if a date is valid or not
- Check if given four integers (or sides) make rectangle
- Check if it is possible to create a polygon with given n sides
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.