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
#include <bits/stdc++.h> NEW_LINE using namespace std ; float trianglearea ( float a ) { if ( a < 0 ) return -1 ; float area = ( 3 * sqrt ( 3 ) * pow ( a , 2 ) ) / 4 ; return area ; } int main ( ) { float a = 6 ; cout << trianglearea ( a ) << endl ; return 0 ; }