SCC - Seminole Community CollegeGo to your search results
AdmissionsDegrees and ProgramsCampus LifeContact UsFrequently Asked QuestionsMySCCQuick LinksFuture Students Navigational Options Triangles Programming Problem

Triangles Computer Programming Contest


Problem Description

Create a program that reads three integer numbers. Each of these numbers represent one side of a triangle. The program must determine if lines of these three lengths could be used to create a triangle. If a triangle could be created, the program must further determine if that triangle would be an equilateral triangle, an isosceles triangle, a right triangle, or a regular triangle.

Assume three lines can make a triangle if the sum of the lengths of the two shorter lines is greater than or equal to the length of the longest line. For example, given lines of length 5, 3, and 7, you could make a triangle. This is because 5 + 3 is greater than 7. However, lines of length 3, 5, and 9 could not make a triangle. This is because 3 + 5 is less than 9.

If the lines can make a triangle, determine if the triangle is an equilateral triangle, an isosceles triangle, a right triangle, or a regular triangle. An isosceles triangle is one in which two of the three sides are equal and the conditions above are met. An equilateral triangle is one in which all three sides are equal and the conditions above are met. A right-triangle is one in which the sum of the squares of two sides equals the sum of the square of the third side and the conditions above are met. For example, a triangle with side lengths of 3, 4, and 5 is a right triangle because 32 + 42 = 52.

Input

Three positive integer values representing the three sides of a triangle will be entered. You do not need to edit to ensure only numbers are entered. You may request the input be entered at one time or use three separate prompts - one for each input value. The values for the line lengths can be entered in any order. For example, you can't assume the longest length will always be entered first. You can't assume the lengths will always be entered in descending or ascending order.

Your values may be input as a single set of data or as a grouping of three individual pieces of data. Your application can be created to process a single set of data. That is, after processing a set of data, your application can end. You can then start the application again and enter a second set of data. If you use a graphical interface (Visual Basic, C#, ...) you can enter the data in text boxes and display the results in text boxes or labels. However, a graphical interface is not required for this application. If you create a command line application you can prompt for the input numbers one at a time or enter them all in a single input statement.

Sample Input/Output

Input Output
3, 4, 5 right triangle
3, 5, 3isosceles triangle
2, 10, 2 not a triangle
3, 3, 3 equilateral triangle
5, 10, 20 not a triangle
10, 0, 5 not a triangle
7, 14, 20regular triangle
Want more information?

Melinda White
Program Manager
Phone: 407.708.2447
Fax: 407.708.2322
Office: V102-I
whitemc@scc-fl.edu

Get Admissions Info
or call 407.708.2050

Did you know?

SCC's high-tech A.S. Degree programs give students the foundation to continue their education at four-year colleges/universities or enter the job market as a programmer.