• Courses
  • Tutorials
  • DSA
  • Data Science
  • Web Tech
September 06, 2022 |870 Views

Javascript program to find area of triangle

  Share   Like
Description
Discussion

In this video, we will write a Javascript Program to find the area of triangles.

Area of a triangle:
The area of a triangle is defined as the total space occupied by the three sides of a triangle in a 2- dimensional plane.

Formula:
A = 1/2 × b ×h

Example:
Input h and b : 3 4
Output Area = 6

Now, in this video, we calculate the area of the triangle using two different methodologies
1. Using the height and base of the triangle
2. Using three sides of the triangle

Formula:
=> (semi-perimeter) s = (a+b+c) / 2;
=> area = Math.sqrt(s * ((s - a) * (s - b) * (s - c)));

 Javascript Program to find the area of triangles.
 https://www.geeksforgeeks.org/how-to-find-the-area-of-a-triangle-using-javascript/