Solved
Write a program to read in three values which represent the lengths of the sides of a triangle. Determine if the triangle is
Posted on 2010-08-31
1. An invalid triangle (the sum of any two sides is less than or equal to the third side)
2. Equilateral (all sides are equal)
3. Isosceles (any two sides are equal)
4. Right (The sum of the squares of the two legs is equal to the square of the hypotenuse.)
5. Regular (if none of the above apply). If regular, also determine if the triangle is an
A. Acute triangle (the square of the longest side <= sum of the squares of the other
two sides) OR
B. Obtuse triangle (the square of the longest side exceeds the sum of the squares of
the other two sides.)
The criteria listed above should be tested in the order given. Treat the above criteria (1-5) as mutually exclusive so any particular case will satisfy only one criteria.
Process several cases of data with one run of your program and label all output appropriately.
Input for each case: 3 integer values representing the lengths of the sides of a possible triangle
Output for each case: the 3 input values
a message indicating the type of triangle OR an appropriate error message
Output to the screen. Use the following data as sample inputs (input only the 3 integers):
Side 1 Side 2 Side 3
Case 1 3 5 4
Case 2 4 3 2
Case 3 5 5 5
Case 4 3 6 3
Case 5 12 5 13
Case 6 -7 -7 -7
Case 7 7 5 5
Case 8 0 5 0
Terminate processing only when all three input values are zero. Print an appropriate error message if at least one side is equal to or less than zero but continue processing subsequent cases.