Largest cube that can be inscribed within a right circular cylinder | C ++ Program to find the biggest cube inscribed within a right circular cylinder ; Function to find the volume of the cube ; height and radius cannot be negative ; volume of the cube ; Driver code
#include <bits/stdc++.h> NEW_LINE using namespace std ; float cube ( float h , float r ) { if ( h < 0 && r < 0 ) return -1 ; float a = pow ( h , 3 ) ; return a ; } int main ( ) { float h = 5 , r = 4 ; cout << cube ( h , r ) << endl ; return 0 ; }