Computer >> Computer tutorials >  >> Programming >> C programming

Area of a circle inscribed in a regular hexagon?


The circle inscribed in a regular hexagon has 6 points touching the six sides of the regular hexagon.

To find the area of inscribed circle we need to find the radius first. For the regular hexagon the radius is found using the formula, a(√3)/2.

Now area of the circle inscribed is 3πa*a/4

Sample

Side of hexagon − 4

Area = 37.68

Example Code

#include <stdio.h>
int main(void) {
   int a = 14;
   float pie = 3.14;
   float area = (float)(3*a*a*pie/4);
   printf("The area of circle inscribed in the hexagon of side %d is %f", a, area);
   return 0;
}

Output

The area of circle inscribed in the hexagon of side 14 is 461.580017