Centered hexagonal number | C # Program to find nth centered hexadecimal number ; Function to find centered hexadecimal number ; Formula to calculate nth centered hexadecimal number and return it into main function ; Driver Code
using System ; class GFG { static int centeredHexagonalNumber ( int n ) { return 3 * n * ( n - 1 ) + 1 ; } public static void Main ( ) { int n = 10 ; Console . Write ( n + " th ▁ centered ▁ " + " hexagonal ▁ number : ▁ " ) ; Console . Write ( centeredHexagonalNumber ( n ) ) ; } }