Given a number N, the task is to check if N is a Decagonal Number or not. If the number N is an Decagonal Number then print “Yes” else print “No”.
Decagonal Number is a figurate number that extends the concept of triangular and square numbers to the decagon (10-sided polygon). The nth decagonal numbers count the number of dots in a pattern of n nested decagons, all sharing a common corner, where the ith decagon in the pattern has sides made of i dots spaced one unit apart from each other. The first few decagonal numbers are 1, 10, 27, 52, 85, 126, 175, …
Input: N = 10
Second decagonal number is 10.
Input: N = 30
- The Kth term of the decagonal number is given as
- As we have to check that the given number can be expressed as a Decagonal Number or not. This can be checked as:
- If the value of K calculated using the above formula is an integer, then N is a Decagonal Number.
- Else N is not a Decagonal Number.
Below is the implementation of the above approach:
GeeksforGeeks has prepared a complete interview preparation course with premium videos, theory, practice problems, TA support and many more features. Please refer Placement 100 for details
- Program to check if N is a Centered Decagonal Number
- C program to find Decagonal Number
- Centered decagonal number
- Program to check whether a number is Proth number or not
- Program to check if N is a Icosidigonal Number
- Program to check if N is a Hexagonal Number or not
- Program to check if N is a Heptadecagonal Number
- Program to check if N is a Icosagonal Number
- Program to check if N is a Star Number
- Program to check Plus Perfect Number
- Program to check Strong Number
- Program to check if N is a Tetradecagonal Number
- Program to check if N is a Hendecagonal Number
- Program to check if N is a Pentadecagonal Number
- Program to check if N is a Heptagonal Number
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.