Program to check if N is a Octadecagon number | C ++ program for the above approach ; Function to check if N is a Octadecagon Number ; Condition to check if the number is a Octadecagon number ; Driver Code ; Given Number ; Function call
#include <bits/stdc++.h> NEW_LINE using namespace std ; bool isOctadecagon ( int N ) { float n = ( 14 + sqrt ( 128 * N + 196 ) ) / 32 ; return ( n - ( int ) n ) == 0 ; } int main ( ) { int N = 18 ; if ( isOctadecagon ( N ) ) { cout << " Yes " ; } else { cout << " No " ; } return 0 ; }