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