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