Program for centered nonagonal number | CPP Program to find nth centered nonagonal number . ; Function to find nth centered nonagonal number . ; Formula to find nth centered nonagonal number . ; Driver function .
#include <bits/stdc++.h> NEW_LINE using namespace std ; int centeredNonagonal ( int n ) { return ( 3 * n - 2 ) * ( 3 * n - 1 ) / 2 ; } int main ( ) { int n = 10 ; cout << centeredNonagonal ( n ) ; return 0 ; }