Finding n | C # Program to Finding n - th term of series 3 , 13 , 42 , 108 , 235 . . . ; Function to generate a fixed number ; Driver Code
using System ; class GFG { public static int magicOfSequence ( int N ) { int sum = 0 ; for ( int i = 1 ; i <= N ; i ++ ) sum += ( i * i * i + i * 2 ) ; return sum ; } static public void Main ( ) { int N = 4 ; Console . WriteLine ( magicOfSequence ( N ) ) ; } }