- C++ Basics
- C++ Home
- C++ Overview
- C++ Environment Setup
- C++ Basic Syntax
- C++ Comments
- C++ Data Types
- C++ Variable Types
- C++ Variable Scope
- C++ Constants/Literals
- C++ Modifier Types
- C++ Storage Classes
- C++ Operators
- C++ Loop Types
- C++ Decision Making
- C++ Functions
- C++ Numbers
- C++ Arrays
- C++ Strings
- C++ Pointers
- C++ References
- C++ Date & Time
- C++ Basic Input/Output
- C++ Data Structures

- C++ Object Oriented
- C++ Classes & Objects
- C++ Inheritance
- C++ Overloading
- C++ Polymorphism
- C++ Abstraction
- C++ Encapsulation
- C++ Interfaces

# Area of the Largest Triangle inscribed in a Hexagon in C++

Here we will see the area of largest triangle which is inscribed in regular hexagon. Each side of the hexagon is ‘a’, and each side of the triangle is ‘b’.

From this diagram we can see that if we make one triangle using one side of hexagon, then these two triangles are making each sides into two parts. We can see two right angled triangles also. From the Pythagorus formula, we can say that −

So the area is −

## Example

#include <iostream> #include <cmath> using namespace std; float area(float a) { if (a < 0 ) //if value is negative it is invalid return -1; float area = (3 * sqrt(3) * pow(a, 2)) / 4; return area; } int main() { float a = 6; cout << "Area : " << area(a); }

## Output

Area : 46.7654

- Related Articles
- C++ program to find the Area of the Largest Triangle inscribed in a Hexagon?
- Area of a circle inscribed in a regular hexagon?
- Area of a square inscribed in a circle which is inscribed in a hexagon in C Program?
- Area of largest triangle that can be inscribed within a rectangle in C Program?
- C Program for Area of a square inscribed in a circle which is inscribed in a hexagon?
- Biggest Reuleaux Triangle inscribed within a square which is inscribed within a hexagon in C?
- Area of the largest triangle that can be inscribed within a rectangle?
- Find the area of largest circle inscribed in ellipse in C++
- Area of a triangle inscribed in a rectangle which is inscribed in an ellipse In C Program?
- Biggest Reuleaux Triangle inscribed within a square which is inscribed within a hexagon?
- Area of a square inscribed in a circle which is inscribed in an equilateral triangle in C Program?
- Area of a square inscribed in a circle which is inscribed in an equilateral triangle in C Program?
- Area of a triangle inscribed in a rectangle which is inscribed in an ellipse?
- Area of the Largest square that can be inscribed in an ellipse in C++
- Area of largest Circle inscribed in N-sided Regular polygon in C Program?

Advertisements