Largest cone that can be inscribed within a cube | Function to find the radius of the cone ; side cannot be negative ; radius of the cone ; Function to find the height of the cone ; side cannot be negative ; height of the cone ; Driver code
< ? php function coneRadius ( $ a ) { if ( $ a < 0 ) return -1 ; $ r = $ a / sqrt ( 2 ) ; return $ r ; } function coneHeight ( $ a ) { if ( $ a < 0 ) return -1 ; $ h = $ a ; return $ h ; } $ a = 6 ; echo ( " r ▁ = ▁ " ) ; echo coneRadius ( $ a ) ; echo ( " , ▁ " ) ; echo ( " h ▁ = ▁ " ) ; echo ( coneHeight ( $ a ) ) ; ? >