C Program for Area of a square inscribed in a circle which is inscribed in a hexagon?

CServer Side ProgrammingProgramming

Given, A square that is inscribed within a circle that is inscribed in a regular hexagon and we need to find the area of the square, for that we need to find the relation of the side of square and the side of the hexagon.

The mathematical formula for the radius of circle inscribed within the hexagon is, r=A√3/2

Since, the diagonal of square is equal to diameter of the circle, so the relation between the radius and side is, a=√r

Based on the side of hexagon,

a = √3A/√2

So, Area of the Square, Area=a2 = (√3A/√2)2


#include <stdio.h>
#include <math.h>
int main() {
   float a = 5;
   float area = pow((a * sqrt(3)) / (sqrt(2)), 2);
   printf("area = %f", area);
   return 0;


area = 37.500000
Updated on 09-Aug-2019 06:57:01