Centered Hexadecagonal Number | C ++ Program to find nth centered hexadecagonal number ; centered hexadecagonal function ; Formula to calculate nth centered hexadecagonal number ; Driver Code
#include <bits/stdc++.h> NEW_LINE using namespace std ; int center_hexadecagonal_num ( long int n ) { return 8 * n * n - 8 * n + 1 ; } int main ( ) { long int n = 2 ; cout << n << " th ▁ centered ▁ hexadecagonal ▁ number ▁ : ▁ " << center_hexadecagonal_num ( n ) ; cout << endl ; n = 12 ; cout << n << " th ▁ centered ▁ hexadecagonal ▁ numbe ▁ : ▁ " << center_hexadecagonal_num ( n ) ; return 0 ; }