Program to check if N is a Concentric Hexagonal Number | C ++ program to check if N is a Concentric Hexagonal Number ; Function to check if the number is a Concentric hexagonal number ; Condition to check if the number is a Concentric hexagonal number ; Driver Code ; Function call
#include <bits/stdc++.h> NEW_LINE using namespace std ; bool isConcentrichexagonal ( int N ) { float n = sqrt ( ( 2 * N ) / 3 ) ; return ( n - ( int ) n ) == 0 ; } int main ( ) { int N = 6 ; if ( isConcentrichexagonal ( N ) ) { cout << " Yes " ; } else { cout << " No " ; } return 0 ; }