Largest rectangle that can be inscribed in a semicircle | Function to find the area of the biggest rectangle ; the radius cannot be negative ; area of the rectangle ; Driver code
function rectanglearea ( r ) { if ( r < 0 ) return - 1 ; var a = r * r ; return a ; } var r = 5 ; document . write ( parseInt ( rectanglearea ( r ) ) ) ;