Diagonal of a Regular Hexagon | Java Program to find the diagonal of a regular hexagon ; Function to find the diagonal of a regular hexagon ; Side cannot be negative ; Length of the diagonal ; Driver code
public class GFG { static double hexDiagonal ( float a ) { if ( a < 0 ) return - 1 ; double d = ( double ) 1.73 * a ; return d ; } public static void main ( String [ ] args ) { float a = 9 ; System . out . println ( hexDiagonal ( a ) ) ; } }