Computes the area of a triangle from its three side lengths using Heron's formula.
Published for review. The Founder is checking every card himself; anything he strikes comes down the same hour.
Try it
Inputs
a (number, length units, required) min 0 : First side length.
b (number, length units, required) min 0 : Second side length.
c (number, length units, required) min 0 : Third side length.
Outputs
area (square length units): Triangle area.
Steps
Compute the semiperimeter s = (a + b + c) / 2.
Check the triangle inequality: s*(s-a)*(s-b)*(s-c) must be positive, otherwise the three lengths cannot form a triangle.
area = sqrt( s*(s-a)*(s-b)*(s-c) ).
Round to 2 decimals.
Constants
None.
Sources
Introduction to Geometry, 2nd ed., Heron's formula (Wiley, 2026-09-30T19:46:00Z) - Standard geometry reference for Heron's formula (attributed to Heron of Alexandria, Metrica).