Largest right circular cone that can be inscribed within a sphere which is inscribed within a cube | C # Program to find the biggest right circular cone that can be inscribed within a right circular cone which in turn is inscribed within a cube ; Function to find the biggest right circular cone ; side cannot be negative ; radius of right circular cone ; height of right circular cone ; volume of right circular cone ; Driver code
using System ; class GFG { static double cone ( double a ) { if ( a < 0 ) return - 1 ; double r = ( double ) ( a * Math . Sqrt ( 2 ) ) / 3 ; double h = ( 2 * a ) / 3 ; double V = ( double ) ( 3.14 * Math . Pow ( r , 2 ) * h ) ; return Math . Round ( V , 4 ) ; } static void Main ( ) { double a = 5 ; Console . WriteLine ( cone ( a ) ) ; } }