Question
Write a program to calculate the area of a triangle given the length of its three sides $-a, b,$ and $c-$ using these formulas:\[\begin{array}{c}s=\frac{a+b+c}{2} \\A=\sqrt{s(s-a)(s-b)(s-c)}\end{array}\]
Step 1
First, we need to take input for the three sides of the triangle (a, b, and c). Show more…
Show all steps
Your feedback will help us improve your experience
Willis James and 61 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
(Geometry: area of a triangle) Write a program that prompts the user to enter three points $(x 1, y 1),(x 2, y 2),(x 3, y 3)$ of a triangle and displays its area. The formula for computing the area of a triangle is $$s=(\text {side} 1+\text {side} 2+\text {side} 3) / 2$$ $$\text {area}=\sqrt{s(s-\text {side} 1)(s-\text {side} 2)(s-\text {side} 3)}$$ Here is a sample run:
(Geometry: area of a triangle) Write a program that prompts the user to enter the three points $(x 1, y 1),(x 2, y 2),$ and $(x 3, y 3)$ of a triangle and displays its area. The formula for computing the area of a triangle is \[ \begin{array}{l} s=(\text {side} 1+\text {side} 2+\text {side3}) / 2 \\ \text {area}=\sqrt{s(s-\text {side} 1)(s-\text {side} 2)(s-\text {side3})} \end{array} \] Here is a sample run: Enter three points for a triangle: 1.5,-3.4,4.6,5 \[ 9.5,-3.4 \] The area of the triangle is 33.6
Use Heron's formula to determine the area ( $A$ ) of a triangle with sides of length $a, b,$ and $c .$ Write each answer as a simplified radical. $A=\sqrt{s(s-a)(s-b)(s-c)} \quad$ where $s=\frac{a+b+c}{2}$
Review of Prerequisites
Rational Exponents and Radicals
Transcript
Watch the video solution with this free unlock.
EMAIL
PASSWORD