
- 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
Diagonal of a Regular Heptagon in C++?
To find the length of the diagonal we put the value of side in 2*side*sin (900/14). The value of sin (900/14) = 0.9.
Example
Let us see the following implementation to get the regular Heptagon diagonal from its side −
#include <iostream> using namespace std; int main(){ float side = 12; if (side < 0) return -1; float diagonal = 2*side*0.9; cout << "The diagonal of the heptagon = "<<diagonal<< endl; return 0; }
Output
The above code will produce the following output −
The diagonal of the heptagon = 21.6
- Related Articles
- Diagonal of a Regular Heptagon in C++ Program
- Diagonal of a Regular Pentagon in C++?
- Diagonal of a Regular Pentagon in C++ Program
- Diagonal of a Regular Hexagon in C++?\n
- Find the number of triangles in a heptagon if drawn from a single vertex.
- Diagonal Sum of a Binary Tree in C++?
- Diagonal product of a matrix - JavaScript
- Area of a square from diagonal length in C++
- What is a diagonal?
- Program to find diagonal sum of a matrix in Python
- Find length of Diagonal of Hexagon in C++
- Diagonal Traversal of Binary Tree in C++?
- Find the number of diagonal in hexagon.
- Area of a circle inscribed in a regular hexagon?
- Diagonal Traverse in C++

Advertisements