Program to find the side of the Octagon inscribed within the square | C ++ Program to find the side of the octagon which can be inscribed within the square ; Function to find the side of the octagon ; side cannot be negative ; side of the octagon ; Driver code ; Get he square side ; Find the side length of the square
#include <bits/stdc++.h> NEW_LINE using namespace std ; float octaside ( float a ) { if ( a < 0 ) return -1 ; float s = a / ( sqrt ( 2 ) + 1 ) ; return s ; } int main ( ) { float a = 4 ; cout << octaside ( a ) << endl ; return 0 ; }