Find length of Diagonal of Hexagon | C ++ Program to find the diagonal of the hexagon ; Function to find the diagonal of the hexagon ; side cannot be negative ; diagonal of the hexagon ; Driver code
#include <bits/stdc++.h> NEW_LINE using namespace std ; float hexadiagonal ( float a ) { if ( a < 0 ) return -1 ; return 2 * a ; } int main ( ) { float a = 4 ; cout << hexadiagonal ( a ) << endl ; return 0 ; }