Trigonometry: Calculate the Area of a Triangle

Trigonometry: Calculate the Area of a Triangle. Use of Sine function to find area of triangle. This program uses radians for the input angles.

Program


---

Trigonometry: Calculate the Area of a Triangle

Use of Sine function to find area of triangle

This program uses radians for the input angles.

By Geoff Fellows

---


prog_vars =

d/length1 0.0

d/length2 0.0

d/degrees_angle 0.0

d/radians 0.0

d/area 0.0

d/raw_sine 0.0

d/pi 0.0

prog_vars.


prog_start =

"Calculate the area of a triangle using the Sine function"

"You need the length of two sides and the angle joining them"

div 22 7 -> /pi

-- the input sine function expects radians not degrees

-- which means we will convert the angle to radians

prog_start.


prog_loop =

"Enter length one and two and the angle"

getline -> /length1

getline -> /length2

getline -> /degrees_angle

"/length1 /length2 /degrees_angle"

-- convert degress to radians

div /degrees_angle 180 -> /radians

mul /radians /pi -> /radians

"/degrees_angle degrees = /radians radians"

sin /radians -> /raw_sine

mul 0.5 /length1 /length2 /raw_sine -> /area

"================================="

"Print the area of the triangle is /area"

exitprog

prog_loop.


prog_stop =

print "Good bye"

prog_stop.