Objective – Given three sides of triangle, write a program to find the area of a triangle.
Heron’s Formula for finding area of triangle:
- First find the semi parameter of a triangle using formula, s= (a+b+c)/2 where a, b, c are three sides of triangle and s will the semi parameter.
- Then use the below formula to get the area of triangle.
- Area = √s(s-a)(s-b)(s-c)
Java Code:
Output:
Area of triangle : 7.826237921249264 sq uni