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
using System ; class GFG { static double octadiagonal ( double a ) { if ( a < 0 ) return - 1 ; return a * Math . Sqrt ( 4 + ( 2 * Math . Sqrt ( 2 ) ) ) ; } public static void Main ( ) { double a = 4 ; Console . WriteLine ( octadiagonal ( a ) ) ; } }