Centered decagonal number | Program to find nth centered decagonal number ; Centered decagonal number function ; Formula to calculate nth centered decagonal number & return it into main function . ; Driver Code
#include <bits/stdc++.h> NEW_LINE using namespace std ; int centereddecagonalnum ( int n ) { return ( 5 * n * n + 5 * n + 1 ) ; } int main ( ) { int n = 5 ; cout << n << " th ▁ centered ▁ decagonal " << " number : ▁ " ; cout << centereddecagonalnum ( n ) ; cout << endl ; n = 9 ; cout << n << " th ▁ centered ▁ decagonal " << " number : ▁ " ; cout << centereddecagonalnum ( n ) ; return 0 ; }