C Source Code/Area of a triangle
Appearance
#include<stdio.h>
#include<math.h>
/* main: calculate the area of a triangle using Heron's Formula */
int main(void)
{
float a, b, c, s, area;
printf("Enter sides of triangle: ");
scanf("%f%f%f", &a, &b, &c);
s = (a + b + c) / 2;
/* no error checking: sqrt() works only if its arg >= 0 */
area = sqrt(s * (s-a) * (s-b) * (s-c));
printf("Area = %f\n", area);
/* indicate success */
return 0;
}