Area of hexagon with given diagonal length in C Program?


A Hexagon is a closed figure of 6 side and a regular hexagon is the one which has all six sides equal and angle equal. For finding the area of hexagon, we are given only the length of its diagonal i.e d.

The interior angles of Hexagon are of 120 degrees each and the sum of all angles of a Hexagon is 720 degrees.

The formula to find the area of hexagon with side length a,

Area = (3a2 √3) / 2.

Since all sides are of same size and angle is 120 degrees,

d = 2a or a = d/2

By putting the value of a in the form of d we get area in terms of d,

2 √3 ) / 8

Example

#include <stdio.h>
#include<math.h>
int main() {
   float d = 10;
   float area = (3 * sqrt(3) * pow(d, 2)) / 8;
   printf("Area of hexagon = %f",area);
   return 0;
}

Output

Area of hexagon = 64.951904

Updated on: 09-Aug-2019

765 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements