# n-th term in series 2, 12, 36, 80, 150….

Given a series 2, 12, 36, 80, 150.. Find the n-th term of the series.

Examples :

```Input : 2
Output : 12

Input : 4
Output : 80
```

## Recommended: Please try your approach on {IDE} first, before moving on to the solution.

If we take a closer look, we can notice that series is sum of squares and cubes of natural numbers (1, 4, 9, 16, 25, …..) + (1, 8, 27, 64, 125, ….).

Therefore n-th number of the series is n^2 + n^3

## C++

 `// CPP program to find n-th term of ` `// the series  2, 12, 36, 80, 150, .. ` `#include ` `using` `namespace` `std; ` ` `  `// Returns n-th term of the series ` `// 2, 12, 36, 80, 150 ` `int` `nthTerm(``int` `n) ` `{ ` `    ``return` `(n * n) + (n * n * n); ` `} ` ` `  `// driver code ` `int` `main() ` `{ ` `    ``int` `n = 4; ` `    ``cout << nthTerm(n); ` `    ``return` `0; ` `} `

## Java

 `//java program to find n-th term of ` `// the series 2, 12, 36, 80, 150, .. ` `import` `java.util.*; ` ` `  `class` `GFG ` `{ ` `    ``// Returns n-th term of the series ` `    ``// 2, 12, 36, 80, 150 ` `    ``public` `static` `int` `nthTerm(``int` `n) ` `    ``{ ` `        ``return` `(n * n) + (n * n * n); ` `    ``} ` `     `  `    ``// Driver code  ` `    ``public` `static` `void` `main(String[] args) ` `    ``{ ` `        ``int` `n = ``4``; ` `        ``System.out.print(nthTerm(n)); ` `    ``} ` `} ` ` `  `// This code is contributed by rishabh_jain `

## Python3

 `# Python3 code to find n-th term of ` `# the series 2, 12, 36, 80, 150, .. ` ` `  `# Returns n-th term of the series ` `# 2, 12, 36, 80, 150 ` `def` `nthTerm( n ): ` `    ``return` `(n ``*` `n) ``+` `(n ``*` `n ``*` `n) ` ` `  `# driver code ` `n ``=` `4` `print``( nthTerm(n)) ` ` `  `# This code is contributed  ` `# by "Sharad_Bhardwaj". `

## C#

 `// C# program to find n-th term of ` `// the series 2, 12, 36, 80, 150, .. ` `using` `System; ` ` `  `class` `GFG ` `{ ` `    ``// Returns n-th term of the series ` `    ``// 2, 12, 36, 80, 150 ` `    ``public` `static` `int` `nthTerm(``int` `n) ` `    ``{ ` `        ``return` `(n * n) + (n * n * n); ` `    ``} ` `     `  `    ``// Driver code  ` `    ``public` `static` `void` `Main() ` `    ``{ ` `        ``int` `n = 4; ` `        ``Console.WriteLine(nthTerm(n)); ` `    ``} ` `} ` ` `  `// This code is contributed by vt_m. `

## PHP

 ` `

Output :

```80
```

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.

My Personal Notes arrow_drop_up Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

Improved By : jit_t