# Diagonal of a Regular Heptagon in C++?

C++Server Side ProgrammingProgramming

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 −

Live Demo

#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
Updated on 16-Jan-2021 07:46:50