Largest right circular cone that can be inscribed within a sphere | C ++ Program to find the biggest cone that can be inscribed within a sphere ; Function to find the radius of the cone ; radius cannot be negative ; radius of the cone ; Function to find the height of the cone ; side cannot be negative ; height of the cone ; Driver code
#include <bits/stdc++.h> NEW_LINE using namespace std ; float coner ( float R ) { if ( R < 0 ) return -1 ; float r = ( 2 * sqrt ( 2 ) * R ) / 3 ; return r ; } float coneh ( float R ) { if ( R < 0 ) return -1 ; float h = ( 4 * R ) / 3 ; return h ; } int main ( ) { float R = 10 ; cout << " r ▁ = ▁ " << coner ( R ) << " , ▁ " << " h ▁ = ▁ " << coneh ( R ) << endl ; return 0 ; }