text: Largest right circular cylinder within a cube | C # Program to find the biggest right circular cylinder that can be fit within a cube ; Function to find the biggest right circular cylinder ; side cannot be negative ; radius of right circular cylinder ; height of right circular cylinder ; volume of right circular cylinder ; Driver code
code: using System ; class GFG { static float findVolume ( float a ) { if ( a < 0 ) return - 1 ; float r = a / 2 ; float h = a ; float V = ( float ) ( 3.14 * Math . Pow ( r , 2 ) * h ) ; return V ; } public static void Main ( ) { float a = 5 ; Console . WriteLine ( findVolume ( a ) ) ; } }