VOOZH about

URL: https://www.geeksforgeeks.org/dsa/c-program-find-area-triangle/

⇱ Program to find area of a triangle - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Program to find area of a triangle

Last Updated : 23 Jul, 2025

Given the sides of a triangle, the task is to find the area of this triangle.

Examples : 

Input : a = 5, b = 7, c = 8
Output : Area of a triangle is 17.320508


Input : a = 3, b = 4, c = 5
Output : Area of a triangle is 6.000000
Recommended Practice

Approach: The area of a triangle can simply be evaluated using following formula. 

where a, b and c are lengths of sides of triangle, and 
s = (a+b+c)/2

👁 Program to find area of a triangle

Below is the implementation of the above approach:


Output
Area is 6

Time Complexity: O(log2n)
Auxiliary Space: O(1), since no extra space has been taken.

Given the coordinates of the vertices of a triangle, the task is to find the area of this triangle.

Approach: If given coordinates of three corners, we can apply the Shoelace formula for the area below.  


Output
2

Time Complexity: O(n)
Auxiliary Space: O(1)

Comment