Number of cells in the Nth order figure | C # implementation of the approach ; Function to return the number of cells in the nth order figure of the given type ; Driver code
using System ; class GFG { static int cntCells ( int n ) { int cells = ( int ) Math . Pow ( n , 2 ) + ( int ) Math . Pow ( n - 1 , 2 ) ; return cells ; } public static void Main ( String [ ] args ) { int n = 3 ; Console . WriteLine ( cntCells ( n ) ) ; } }