Program to check if N is a Chiliagon Number | C ++ for the above approach ; Function to check that if N is Chiliagon Number or not ; Condition to check if N is a Chiliagon Number ; Driver Code ; Given Number ; Function call
#include <bits/stdc++.h> NEW_LINE using namespace std ; bool is_Chiliagon ( int N ) { float n = ( 996 + sqrt ( 7984 * N + 992016 ) ) / 1996 ; return ( n - ( int ) n ) == 0 ; } int main ( ) { int N = 1000 ; if ( is_Chiliagon ( N ) ) { cout << " Yes " ; } else { cout << " No " ; } return 0 ; }