Centered pentagonal number | Program to find nth Centered pentagonal number . ; centered pentagonal number function ; Formula to calculate nth Centered pentagonal number and return it into main function . ; Driver Code
#include <bits/stdc++.h> NEW_LINE using namespace std ; int centered_pentagonal_Num ( int n ) { return ( 5 * n * n - 5 * n + 2 ) / 2 ; } int main ( ) { int n = 7 ; cout << n << " th ▁ Centered ▁ pentagonal ▁ number : ▁ " ; cout << centered_pentagonal_Num ( n ) ; return 0 ; }