Find area of equilateral triangle - C Program

C program to calculate area of equilateral triangle.

Solution:

Formula:


formula

In this program, first calculate square root of 3 using function sqrt. This function is included in header file <math.h>.  

#include<stdio.h>
#include<math.h>
int main()
{
     int side;
     float sq,area;
     sq=sqrt(3)/4.0;
     printf("Enter Side of Equilateral Triangle : ");
     scanf("%d", &side);
     area=sq*side*side;
     printf("\nArea of Equilateral Triangle = %.3f",area);
     return 0;
}


Output:

area equilateral triangle