Question: Write a program to evaluate the area of a triangle given the lengths of its sides using Heron's Formula 1 . Here is an outline:
Write a program to evaluate the area of a triangle given the lengths of its sides using Heron's Formula
Here is an outline:
Get the three side lengths from the user which might have decimal values: a b c
Check to ensure that the sides are valid for a triangle. Importantly, the sum of the lengths of any
two sides must be larger than the length of the third side you must check all three sides this way
Calculate the semiperimeter s:
Calculate the area:
You must format the output to have two decimal places even if they are both and round if necessary.
For example:
Enter the length of side a:
Enter the length of side b:
Enter the length of side c:
The area is
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
