text: Program to find Nth term of the series 3 , 6 , 18 , 24 , ... | C # program to find N - th term of the series : 3 , 6 , 18 , 24 , 45 , 54. . . ; By using above formula ; Driver Code ; get the value of N ; create object of Class Nth ; Calculate and print the Nth term
code: using System ; class GFG { public int nthTerm ( int N ) { return ( N * ( ( N / 2 ) + ( ( N % 2 ) * 2 ) + N ) ) ; } public static void Main ( ) { int N = 5 ; GFG a = new GFG ( ) ; Console . WriteLine ( " Nth ▁ term ▁ for ▁ N ▁ = ▁ " + N + " ▁ : ▁ " + a . nthTerm ( N ) ) ; } }