
- 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 Pentagon in C++?
To find the length for the diagonal of a regular pentagon we put the value of side in (1+√5)side/2 = (1+2.24)side/2.
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 = 5; if (side < 0) return -1; float diagonal = (1+2.24) *(side/2); cout << "The diagonal of the regular pentagon = "<<diagonal<< endl; return 0; }
Output
The above code will produce the following output −
The diagonal of the regular pentagon = 8.1
- Related Articles
- Diagonal of a Regular Pentagon in C++ Program
- Diagonal of a Regular Heptagon in C++?
- Diagonal of a Regular Hexagon in C++?\n
- Diagonal of a Regular Heptagon in C++ Program
- The perimeter of a regular pentagon is 65 cm. Find the length of each side.
- Program to find the Area of a Pentagon in C++
- The perimeter of a regular pentagon is \( 100 \mathrm{~cm} \). How long is its each side?
- A regular pentagon $ABCDE$ and a square $ABFG$ are formed on opposite sides of $AB$. Find $\angle BCF$.
- A piece of a string is 60 cm long what will be the length of each side if the given string is used to form:A) A square B) An equilateral triangle C) A regular pentagon D) A regular hexagon E) A regular decagon
- Diagonal Sum of a Binary Tree in C++?
- What is a Pentagon?
- Area of a square from diagonal length in C++
- Diagonal Traverse in C++
- How can we find perimeter of a pentagon?
- Diagonal Traversal of Binary Tree in C++?

Advertisements