text: Side of a regular n | Function to calculate the side of the polygon circumscribed in a circle ; Total sides of the polygon ; Radius of the circumscribing circle
code: function calculateSide ( n , r ) { var theta , theta_in_radians ; theta = 360 / n ; theta_in_radians = theta * 3.14 / 180 ; return 2 * r * Math . sin ( theta_in_radians / 2 ) ; } var n = 3 ; var r = 5 ; document . write ( calculateSide ( n , r ) . toFixed ( 5 ) ) ;