Given a square inscribed in a circle inscribed by a regular hexagon, we need to find the area of the square. To do this, we need to find the side length of the square and the sides of the regular hexagon. long relationship.
The mathematical formula for the radius of the inscribed circle of a regular hexagon is, r=A√3/2
Since the diagonal of the square is equal to the diameter of the circle, the distance between the radius and the side length The relationship is, a=√r
According to the side length of the regular hexagon,
a = √3A/√2
So, the 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
The above is the detailed content of C program to calculate the area of a square within a circle inscribed in a hexagon. For more information, please follow other related articles on the PHP Chinese website!