text: Area of a circle inscribed in a rectangle which is inscribed in a semicircle | Function to find the area of the circle ; radius cannot be negative ; area of the circle ; Driver code
code: function area ( r ) { if ( r < 0 ) return - 1 ; var area = ( 3.14 * Math . pow ( r / ( 2 * Math . sqrt ( 2 ) ) , 2 ) ) ; return area ; } var a = 5 ; document . write ( area ( a ) . toFixed ( 6 ) ) ;