Volume of largest right circular cylinder within a Sphere | Function to find the biggest right circular cylinder ; radius cannot be negative ; volume of cylinder ; Driver code
< ? php function cyl ( $ R ) { if ( $ R < 0 ) return -1 ; $ V = ( 2 * 3.14 * pow ( $ R , 3 ) ) / ( 3 * sqrt ( 3 ) ) ; return $ V ; } $ R = 4 ; echo cyl ( $ R ) ; ? >