Largest sphere that can be inscribed in a right circular cylinder inscribed in a frustum | C ++ Program to find the biggest sphere that can be inscribed within a right circular cylinder which in turn is inscribed within 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
#include <bits/stdc++.h> NEW_LINE using namespace std ; float sph ( float r , float R , float h ) { if ( r < 0 && R < 0 && h < 0 ) return -1 ; float x = r ; float V = ( 4 * 3.14 * pow ( r , 3 ) ) / 3 ; return V ; } int main ( ) { float r = 5 , R = 8 , h = 11 ; cout << sph ( r , R , h ) << endl ; return 0 ; }