Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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
Advertisements