text: Largest right circular cylinder within a cube | Function to find the biggest right circular cylinder ; side cannot be negative ; radius of right circular cylinder ; height of right circular cylinder ; volume of right circular cylinder ; Driver code
code: < ? php function findVolume ( $ a ) { if ( $ a < 0 ) return -1 ; $ r = $ a / 2 ; $ h = $ a ; $ V = 3.14 * pow ( $ r , 2 ) * $ h ; return $ V ; } $ a = 5 ; echo findVolume ( $ a ) . " STRNEWLINE " ;