News


Given the lengths of the sides of a triangle, compute the area of the triangle.

Here's one implementation (based completely off a geometry formula):

double printArea(double a, double b, double c)
{
double s = (a + b + c) / 2;
return Math.Sqrt(s * (s - a) * (s - b) * (s - c));
}

posted @ Monday, October 01, 2007 8:05 AM | Filed Under [ Coding Challenge ]

Comments

No comments posted yet.
Post A Comment
Title:
Name:
Email:
Website:
Comment:
Verification: