Largest hexagon that can be inscribed within an equilateral triangle | Java program to find the side of the largest hexagon which can be inscribed within an equilateral triangle ; Function to find the side of the hexagon ; Side cannot be negative ; Side of the hexagon ; Driver code
class CLG { static float hexagonside ( float a ) { if ( a < 0 ) return - 1 ; float x = a / 3 ; return x ; } public static void main ( String [ ] args ) { float a = 6 ; System . out . println ( hexagonside ( a ) ) ; } }