Skip to content

wywise/Polygon_Diagonal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 

Repository files navigation

Polygon Diagonal

With this C++ code you can know how many polygon there is in your "n" ribs diagonal.
All you need to insert is "n" - the numbers of the diagonal ribs.

We can see that to calculate the numbers of polygon we use this formula:

Diagonals = 0.5 * n * (n - 3)

Why I did it?

I was in an interview, where they asked me "How many Diagonals does Octagon have?"
I remembered the function and decided to build a little program that calculates how many diagonals any size of polygon have.

About

How many polygon in "n" ribs diagonal

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages