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
function cyl ( R ) { if ( R < 0 ) return - 1 ; var V = ( ( 2 * 3.14 * Math . pow ( R , 3 ) ) / ( 3 * Math . sqrt ( 3 ) ) ) ; return V ; } var R = 4 ; document . write ( cyl ( R ) . toFixed ( 4 ) ) ;