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.
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
Post a Comment