Centered Octagonal Number | Program to find nth centered octagonal number ; Centered octagonal number function ; Formula to calculate nth centered octagonal number & return it into main function . ; Driver code
using System ; public class GFG { static long cen_octagonalnum ( long n ) { return ( 4 * n * n - 4 * n + 1 ) ; } static public void Main ( ) { long n = 6 ; Console . WriteLine ( n + " th ▁ centered " + " ▁ octagonal ▁ number ▁ : ▁ " + cen_octagonalnum ( n ) ) ; n = 11 ; Console . WriteLine ( n + " th ▁ centered " + " ▁ octagonal ▁ number ▁ : ▁ " + cen_octagonalnum ( n ) ) ; } }