Area of a square inscribed in a circle which is inscribed in a hexagon | Function to find the area of the square ; side of hexagon cannot be negative ; area of the square ; Driver code
function area ( a ) { if ( a < 0 ) return - 1 ; var area = Math . pow ( ( a * Math . sqrt ( 3 ) ) / ( Math . sqrt ( 2 ) ) , 2 ) ; return area ; } var a = 5 ; document . write ( area ( a ) . toFixed ( 5 ) ) ;