To calculate the area of a triangle we need to have the lengths of all three sides, using "Heron's Formula" that has been known for nearly 2000 years.

The following simple program inputs three sides of a triangle from the user and finds out triangle area by Heron's Formula:

Enter second side of triangle: 40

Enter third side of triangle: 60

The sides of triangle = 30, 40, 60

Area of triangle = 533.268

The following simple program inputs three sides of a triangle from the user and finds out triangle area by Heron's Formula:

**Where:**
s = (a + b + c)/2

## Program Source Code

#include<iostream> #include<math.h> using namespace std; int main() { float s, a, b, c, area; std :: cout<<"Enter first side of triangle:\n"; std :: cin>>a; std :: cout<<"Enter second side of triangle:\n"; std :: cin>>b; std :: cout<<"Enter third side of triangle:\n"; std :: cin>>c; s = (a+b+c) / 2.0; area = sqrt (s*(s-a)*(s-b)*(s-c)); std:: cout<<"The sides of triangle = "<<a<<"," <<b<< ","<<c; std :: cout<<"\n Area of triangle = "<<area; return 0; }

## Output of Program

Enter first side of triangle: 30Enter second side of triangle: 40

Enter third side of triangle: 60

The sides of triangle = 30, 40, 60

Area of triangle = 533.268