Question: Write a C++ program to check whether a triangle is valid or not. A triangle is valid if and only if the sum of its

 Write a C++ program to check whether a triangle is valid

Write a C++ program to check whether a triangle is valid or not. A triangle is valid if and only if the sum of its three angles is 180. Your program should ask user to enter the values of the three angles and display if the triangle is valid or not. Further if the triangle is valid, your program should display its type. A triangle is an Equilateral Triangle, if all its angles are equal. A triangle is an Isosceles Triangle, if its two angles are equal A triangle is a Scalene Triangle, if none of its sides are equal. You have to use selection structures such as if else and/or nested if-else. See Sample runs of the program below: Sample Run 1 Enter 3 angles of the 140 40 20 Sample Run 2 Enter 3 angles of the triangle: 60 60 60 Sample Run 3 Enter 3 angles of the triangle: 45 45 90 You entered: angle 1 140 angle2-40 angle3-20 You entered: angle 1-60 angle2 60 angles 60 You entered: angle 1-45 angle2-45 angle3-90 Triangle is valid Equilateral triangle. Triangle is not valid Triangle is valid Isosceles triangle. Text in blue is values entered by user using keyboard. Text in black Sample Run 4 Enter 3 angles of the triangle:is displayed by your program. 40 60 80 You entered: angle 1-40 angle2 60 angle3-80 Triangle is valid Scalene triangle HINTS: if anglel, angle2 and angle3 are the 3 triangle angles. Triangle is valid if sum of the 3 angles is 180.Then the triangle is equilateral only if anglel is equal to angle2 and angle2 is equal to angle3. The triangle is isosceles if either anglel is equal to angle2 or anglel is equal to angle3 or angle2 is equal to angle3. The triangle is scalene if none of its angles are equal

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!