Largest right circular cylinder that can be inscribed within a cone which is in turn inscribed within a cube | Python3 Program to find the biggest right circular cylinder that can be inscribed within a right circular cone which in turn is inscribed 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
import math as mt NEW_LINE def cyl ( a ) : NEW_LINE INDENT if ( a < 0 ) : NEW_LINE INDENT return - 1 NEW_LINE DEDENT r = ( 2 * a * mt . sqrt ( 2 ) ) / 3 NEW_LINE h = ( 2 * a ) / 3 NEW_LINE V = 3.14 * pow ( r , 2 ) * h NEW_LINE return V NEW_LINE DEDENT a = 5 NEW_LINE print ( cyl ( a ) ) NEW_LINE