Centered Octadecagonal Number | C ++ Program to find the nth centered octadecagonal number ; centered octadecagon function ; Formula to calculate nth centered octadecagonal number ; Driver Code
#include <bits/stdc++.h> NEW_LINE using namespace std ; int center_octadecagon_num ( long int n ) { return 9 * n * n - 9 * n + 1 ; } int main ( ) { long int n = 3 ; cout << n << " th ▁ centered ▁ octadecagonal ▁ number ▁ : ▁ " << center_octadecagon_num ( n ) ; cout << endl ; n = 13 ; cout << n << " th ▁ centered ▁ octadecagonal ▁ number ▁ : ▁ " << center_octadecagon_num ( n ) ; return 0 ; }