
- C Programming Tutorial
- C - Home
- C - Overview
- C - Environment Setup
- C - Program Structure
- C - Basic Syntax
- C - Data Types
- C - Variables
- C - Constants
- C - Storage Classes
- C - Operators
- C - Decision Making
- C - Loops
- C - Functions
- C - Scope Rules
- C - Arrays
- C - Pointers
- C - Strings
- C - Structures
- C - Unions
- C - Bit Fields
- C - Typedef
- C - Input & Output
- C - File I/O
- C - Preprocessors
- C - Header Files
- C - Type Casting
- C - Error Handling
- C - Recursion
- C - Variable Arguments
- C - Memory Management
- C - Command Line Arguments
- C Programming useful Resources
- C - Questions & Answers
- C - Quick Guide
- C - Useful Resources
- C - Discussion
C Program for area of hexagon with given diagonal length?
Here we will see how to get the area of one hexagon using diagonal length. The diagonal length of the hexagon is d.
The interior angles of a regular hexagon are 120° each. The sum of all interior angles are 720°. If the diagonal is d, then area is −
Example
#include <iostream> #include <cmath> using namespace std; float area(float d) { if (d < 0) //if d is negative it is invalid return -1; float area = (3 * sqrt(3) * d*d)/8.0; return area; } int main() { float r = 10; cout << "Area : " << area(r); }
Output
Area : 64.9519
- Related Articles
- Area of hexagon with given diagonal length in C Program?
- Find length of Diagonal of Hexagon in C++
- Area of a square from diagonal length in C++
- Diagonal of a Regular Hexagon in C++?\n
- Swift Program to Calculate Area of Hexagon
- Find the number of diagonal in hexagon.
- C Program for Area of a square inscribed in a circle which is inscribed in a hexagon?
- Area of a n-sided regular polygon with given side length in C++
- C++ program to find the Area of the Largest Triangle inscribed in a Hexagon?
- Area of the Largest Triangle inscribed in a Hexagon in C++
- The area of a square is 11250 m2 find the length of its diagonal.
- C program to interchange the diagonal elements in given matrix
- Area of a n-sided regular polygon with given Radius in C Program?
- Program for Area Of Square in C++
- Area of a square inscribed in a circle which is inscribed in a hexagon in C Program?

Advertisements