Write a C program to input side of an equilateral triangle from user and find area of the given triangle. How to find area of an equilateral triangle in C programming. C program to calculate area of an equilateral triangle if its side is given.

**Example**

**Input**

Enter side of the equilateral triangle: 10

**Output**

Area of equilateral triangle = 43.3 sq. units

## Required knowledge

Arithmetic operators, Variables and expressions, Basic input/output

## Area of an equilateral triangle

Area of an equilateral triangle is given by formula.

C equivalent expression to find area of equilateral triangle - `(sqrt(3) / 4) * (side * side)`

## Logic to find area of equilateral triangle

Mathematical formula for area of equilateral triangle in programming notation can be written as (sqrt(3) / 4) * (side * side). Where sqrt() is a function used to compute square root. We will use this formula to find area of equilateral triangle.

Read more - Program to find square root of a number

Below is the step by step descriptive logic to find area of an equilateral triangle.

- Input side of the equilateral triangle. Store it in some variable say
`side`. - Use the formula of equilateral triangle to find area i.e.
`area = (sqrt(3) / 4) * (side * side)`

. - Finally, print the value of resultant
`area`.

## Program to find area of an equilateral triangle

```
/**
* C program to find area of an equilateral triangle
*/
#include <stdio.h>
#include <math.h> // Used for sqrt() function
int main()
{
float side, area;
/* Input side of equilateral triangle */
printf("Enter side of an equilateral triangle: ");
scanf("%f", &side);
/* Calculate area of equilateral triangle */
area = (sqrt(3) / 4) * (side * side);
/* Print resultant area */
printf("Area of equilateral triangle = %.2f sq. units", area);
return 0;
}
```

`sqrt()`

function is used to calculate square root of a number.

Output

Enter side of an equilateral triangle: 75 Area of equilateral triangle = 2435.69 sq. units

Happy coding 😉

### Recommended posts

- Basic programming exercises index.
- C program to find area of a triangle.
- C program to find angle of a triangle if its two angles are given.
- C program to check whether a triangle is valid or not if all its angles are given.
- C program to check whether a triangle is valid or not if all its sides are given.
- C program to check whether a triangle is Equilateral, Isosceles or Scalene triangle.
- C program to find area of rectangle.
- C program to find diameter, circumference and area of rectangle.

<pre><code> ----Your Source Code---- </code></pre>