Largest sphere that can be inscribed in a right circular cylinder inscribed in a frustum | Function to find the biggest sphere ; the radii and height cannot be negative ; radius of the sphere ; volume of the sphere ; Driver code
function sph ( r , R , h ) { if ( r < 0 && R < 0 && h < 0 ) return - 1 ; var x = r ; var V = ( ( 4 * 3.14 * Math . pow ( r , 3 ) ) / 3 ) ; return V ; } var r = 5 , R = 8 , h = 11 ; document . write ( sph ( r , R , h ) . toFixed ( 5 ) ) ;