Diagonal of a Regular Hexagon | C ++ 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
#include <bits/stdc++.h> NEW_LINE using namespace std ; float hexDiagonal ( float a ) { if ( a < 0 ) return -1 ; float d = 1.73 * a ; return d ; } int main ( ) { float a = 9 ; cout << hexDiagonal ( a ) << endl ; return 0 ; }