![]() |
VOOZH | about |
A hexagon is a 6-sided, 2-dimensional geometric figure. The total of the internal angles of any hexagon is 720°. A regular hexagon has 6 rotational symmetries and 6 reflection symmetries. All internal angles are 120 degrees.
Examples :
Input: 4 Output: 41.5692 Input: 6 Output: 93.5307
Number of vertices: 6
Number of edges: 6
Internal angle: 120°
Area = (3 ?3(n)2 ) / 2
How does the formula work? There are mainly 6 equilateral triangles of side n and area of an equilateral triangle is (sqrt(3)/4) * n * n. Since in hexagon, there are total 6 equilateral triangles with side n, area of the hexagon becomes (3*sqrt(3)/2) * n * n
Output :
Area: 41.5692
Time Complexity: O(1)
Auxiliary Space: O(1), since no extra space has been taken.