Volume of largest right circular cylinder within a Sphere | C ++ Program to find the biggest right circular cylinder that can be fit within a sphere ; Function to find the biggest right circular cylinder ; radius cannot be negative ; volume of cylinder ; Driver code
#include <bits/stdc++.h> NEW_LINE using namespace std ; float cyl ( float R ) { if ( R < 0 ) return -1 ; float V = ( 2 * 3.14 * pow ( R , 3 ) ) / ( 3 * sqrt ( 3 ) ) ; return V ; } int main ( ) { float R = 4 ; cout << cyl ( R ) << endl ; return 0 ; }