Centered heptagonal number | CPP program to find n - th Centered heptagonal number ; Function to find Centered heptagonal number ; Formula to calculate nth Centered heptagonal number ; Driver Code
#include <bits/stdc++.h> NEW_LINE using namespace std ; int centered_heptagonal_num ( long int n ) { return ( 7 * n * n - 7 * n + 2 ) / 2 ; } int main ( ) { long int n = 5 ; cout << n << " th ▁ Centered ▁ heptagonal ▁ number ▁ : ▁ " ; cout << centered_heptagonal_num ( n ) ; return 0 ; }