# C Program to Calculate Area of an Equilateral Triangle

• Write a C program to find the area of an equilateral triangle
• Write a C program to find the perimeter of an equilateral triangle

An equilateral triangle is a triangle in which all three sides and angles are equal. All three internal angles of equilateral triangle measures 60 degree.

Area of Equilateral Triangle
The area of an equilateral triangle is the amount of two-dimensional space inside it. In other words, the area of an equilateral triangle can be calculated by placing the trapezoid over a grid and counting the number of square units it takes to completely cover it.
If we know the length of each sides of equilateral triangle, then we can use below mentioned formula to calculate area of equilateral triangle.
• Area of Equilateral Triangle = (√ 3 /4)S2
Where, S is the length of each side of triangle.

If we also know the length of altitude of equilateral triangle along with the length of side, then we can use below mentioned formula to calculate it's area.
• Area of Equilateral Triangle = (1/2)xSidexAltitude
Where, Altitude is the perpendicular distance between a side and the opposite vertex.

Perimeter of Equilateral Triangle
The perimeter of an equilateral triangle is the linear distance around the boundary of triangle. In other words, it is the length of fence required to enclose an equilateral triangle surface. We can calculate the perimeter of a triangle by adding the length of all sides, as all sides of equilateral triangle are equal, it's perimeter is equal to three times side length.
• Perimeter of Equilateral Triangle = 3 X Side
Where, S is the length of each side of triangle.

## C Program to find the area of an equilateral triangle

```/*
* C Program to calculate area of an
* equilateral triangle
*/
#include <stdio.h>
#include <math.h>
#include <conio.h>

int main(){
float side, area;
printf("Enter the length of side of equilateral triangle\n");
scanf("%f", &side);
/* Area of equilateral triangle =
sqrt(3)/4 x Side x Side    */
area = sqrt(3)/4 * side * side;
printf("Area of triangle : %0.4f\n", area);

getch();
return 0;
}
```

Program Output
```Enter the length of side of equilateral triangle
5
Area of triangle : 10.8253
```

To find the area of equilateral triangle we need length of sides of triangle. Above program first takes length of side of triangle as input from user using scanf function and stores it in a floating point variable named 'side'. Then it calculates the area of triangle using above mentioned formula and finally prints the area on screen using printf function.

## C Program to find the perimeter of an equilateral triangle

```/*
* C Program to calculate perimeter of an
* equilateral triangle
*/
#include <stdio.h>
#include <math.h>
#include <conio.h>

int main(){
float side, perimeter;
printf("Enter the length of side of equilateral triangle\n");
scanf("%f", &side);
/* Perimeter of equilateral riangle =
3 X Side */
perimeter = 3 * side;
printf("Perimeter of triangle : %0.4f\n", perimeter);

getch();
return 0;
}
```

Program Output
```Enter the length of side of equilateral triangle
5.0
Perimeter of triangle : 15.0000
```

To find the perimeter of an equilateral triangle we need length of any side. Above program first takes length of side of triangle as input from user using scanf function and stores it in a floating point variable named 'side'. Then it calculates the perimeter which is three times side length and finally prints the perimeter on screen using printf function.

Properties of Equilateral Triangle
• All internal angles of an equilateral triangle are equal. As we know, the sum of internal angles of any triangle must be 180., hence each angle of equilateral triangle measures 60..
• The length of all sides of an equilateral triangle are equal.
• In an equilateral triangle, the radius of the circumcircle is double the radius of the incircle.
• The length of all three medians of equilateral triangle are equal.
• The length of all three altitudes of equilateral triangle are equal.
• The length of all three angle bisectors of equilateral triangle are equal.
• The height of the center of equilateral triangle from each side is h/3.

Related Topics
 C program to calculate area of a right angled triangle C program to calculate area of any triangle C program to calculate area of a rhombus C program to calculate area of a parallelogram C program to calculate area of a trapezium C program to calculate area of a circle C program to calculate volume and total surface area of cone C Program to print fibonacci series List of all C Programs