CPPForSchool.com: Flow of Control Set 1: Assignment 6

6. Write a program to check whether a triangle is valid or not, when the three angles of the triangle are entered by the user. A triangle is valid if the sum of all the three angles is equal to 180 degrees.

This assignment was not very difficult.  I had to merely test the grand total of degrees and ensure that it would equate to 180.  If the total did not equate to 180, the program will inform the user that the triangle is invalid.

I was able to accomplish this using the following formula:

triangle = 1st Angle + 2nd Angle + 3rd Angle


Below is my source code and resulting outputs.







Comments

Popular posts from this blog

CPPForSchool.com: Variable, Operator & Expression Set 1: Assignment 8

CPPForSchool.com: Array - Single Dimension Set 1 Assignment 6

CPPForSchool.com: Variable, Operator & Expression Set 1: Assignment 7