text: Largest right circular cylinder within a frustum | C ++ Program to find the biggest right circular cylinder that can be fit within a frustum ; Function to find the biggest right circular cylinder ; radii and height cannot be negative ; radius of right circular cylinder ; height of right circular cylinder ; volume of right circular cylinder ; Driver code
code: #include <bits/stdc++.h> NEW_LINE using namespace std ; float cyl ( float r , float R , float h ) { if ( h < 0 && r < 0 && R < 0 ) return -1 ; float r1 = r ; float h1 = h ; float V = 3.14 * pow ( r1 , 2 ) * h1 ; return V ; } int main ( ) { float r = 7 , R = 11 , h = 6 ; cout << cyl ( r , R , h ) << endl ; return 0 ; }