About Me

My photo
Raipur, Chhattisgarh, India
Hi , I am Amit Thakur. I have worked as a QA Engineer for two years and as a Java Developer for one year in NIHILENT TECHNOLOGIES PVT. LTD., Pune.Currently I am working as DEAN (Research & Development) in Bhilai Institute of Technology, Raipur.

Tuesday, August 27, 2013

Area of Square


#include<stdio.h>
#include<math.h>

int main()
{
int side;
float area,r_4;

r_4 = sqrt(3) / 4 ;

printf("Enter the Length of Side : ");
scanf("%d",&side);

area = r_4 * side * side ;

printf("Area of Equilateral Triangle : %f",area);
return(0);
}
Output :
Enter the Length of Side : 5
Area of Equilateral Triangle : 10.82

Properties of Equilateral Triangle :

  1. Equilateral triangle is a triangle in which all three sides are equal .
  2. All angles are of measure 60 degree
  3. A three-sided regular polygon

Formula to Calculate Area of Equilateral Triangle :

Explanation of Program :

First of all we have to find the value of Root 3 / 2. So we have used following statement to compute the value.
r_4 = sqrt(3) / 4 ;
Now after computing the value of the Root 3 by 2 we have multiplied it by Square of the side.
area = r_4 * side * side ;

No comments: