Program to check if N is a Centered Decagonal Number | C ++ program for the above approach ; Function to check if number N is a Centered decagonal number ; Condition to check if N is Centered Decagonal Number ; Driver Code ; Function call
#include <bits/stdc++.h> NEW_LINE using namespace std ; bool isCentereddecagonal ( int N ) { float n = ( 5 + sqrt ( 20 * N + 5 ) ) / 10 ; return ( n - ( int ) n ) == 0 ; } int main ( ) { int N = 11 ; if ( isCentereddecagonal ( N ) ) { cout << " Yes " ; } else { cout << " No " ; } return 0 ; }