- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

# C++ program to find the Area of the Largest Triangle inscribed in a Hexagon?

Find the area of largest Triangle inscribed in a hexagon we need to learn these figures are and how 1 is inscribed inside other.

**Triangle** is a closed figure with 3 sides which may be equal or different size.

**Hexagon** is a closed figure with 6 sides which may be equal or unequal in size.

A triangle inscribed inside a hexagon has all its vertices touching vertices of hexagon. So, the sides of the triangle can be treated as diagonals of a *regular hexagon*. The hexagon considered here is a regular hexagon, which leads to make the largest triangle an Equilateral triangle.

Let’s derive the formula for this,

Please refer to the following image −

In triangle AGB, we apply pythagoras theorem.

(a/2)

^{2}+ (s/2)^{2}= a^{2},a = side of regular hexagons = side of equilateral triangle

a

a^{2}/4 + s^{2}/4 = a^{2}^{2}- a^{2}/4 = s^{2}/4 3a^{2}/4 = s^{2}/4 3a^{2}= s^{2}a√3 = s Area = (3√3*a^2)/4

Let’s take an example,

Side of hexagon = 6

Area of triangle = 46.7654

Explanation, Area = 3√3*36/4 = 46.7654

## Example

#include <iostream> #include <math.h> using namespace std; int main() { float a = 6; if (a < 0) cout<<"Wrong Input!"; float area = (3 * sqrt(3) * pow(a, 2)) / 4; cout <<"The area of the triangle is "<<area; return 0; }

## Output

The area of the triangle is 46.7654

- Related Articles
- Area of the Largest Triangle inscribed in a Hexagon in C++
- Area of largest triangle that can be inscribed within a rectangle in C Program?
- Area of a square inscribed in a circle which is inscribed in a hexagon in C Program?
- C Program for Area of a square inscribed in a circle which is inscribed in a hexagon?
- Find the area of largest circle inscribed in ellipse in C++
- Area of the largest triangle that can be inscribed within a rectangle?
- Area of a circle inscribed in a regular hexagon?
- Biggest Reuleaux Triangle inscribed within a square which is inscribed within a hexagon in C?
- Area of a triangle inscribed in a rectangle which is inscribed in an ellipse In C Program?
- ( A B C D E F ) is a regular hexagon with centre ( O ). If the area of triangle ( O A B ) is 9 ( mathrm{cm}^{2} ), find the area of the circle in which the hexagon is inscribed."\n
- 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?
- A regular hexagon is inscribed in a circle. If the area of hexagon is ( 24 sqrt{3} mathrm{~cm}^{2} ), find the area of the circle. (Use ( pi=3.14 ) )
- Find the area of the largest triangle that can be inscribed in a semi-circle of radius $r$ units, in square units.
- Area of largest Circle inscribed in N-sided Regular polygon in C Program?