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