Largest trapezoid that can be inscribed in a semicircle | Function to find the area of the biggest trapezoid ; the radius cannot be negative ; area of the trapezoid ; Driver code
< ? php function trapezoidarea ( $ r ) { if ( $ r < 0 ) return -1 ; $ a = ( 3 * sqrt ( 3 ) * pow ( $ r , 2 ) ) / 4 ; return $ a ; } $ r = 5 ; echo trapezoidarea ( $ r ) . " STRNEWLINE " ; ? >