Area of the Largest Triangle inscribed in a Hexagon | C # Program to find the biggest triangle which can be inscribed within the hexagon ; Function to find the area of the triangle ; side cannot be negative ; area of the triangle ; Driver code
using System ; class GFG { static double trianglearea ( double a ) { if ( a < 0 ) return - 1 ; double area = ( 3 * Math . Sqrt ( 3 ) * Math . Pow ( a , 2 ) ) / 4 ; return Math . Round ( area , 4 ) ; } public static void Main ( ) { double a = 6 ; Console . WriteLine ( trianglearea ( a ) ) ; } }