Question: 3. (9) Write a program to calculate the area of a triangle given the lengths of its three sides a, b, c, using Herons formula:

3. (9) Write a program to calculate the area of a triangle given the lengths of its three sides a, b, c, using Herons formula: A = sqrt( s(s a)(s b)(s c)) where s = (a + b + c)/2, the semi-perimeter Get the lengths of the sides from the user. Calculate the area of the triangle and output the area to the screen. Under certain circumstances, the lengths of three line segments do not form a triangle (i. e., the sum of any two sides must be greater than the third a + b > c, a + c > b and b + c > a). Revise the program to check that the line segments will form a triangle and if not, inform the user and ask for different lengths.

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!