# Program to find N-th term of series 2, 12, 28, 50, 77, 112, 152, 198, …in C++

C++Server Side ProgrammingProgramming

#### C in Depth: The Complete C Programming Guide for Beginners

45 Lectures 4.5 hours

#### Practical C++: Learn C++ Basics Step by Step

Most Popular

50 Lectures 4.5 hours

#### Master C and Embedded C Programming- Learn as you go

66 Lectures 5.5 hours

In this problem, we are given a number N. Our task is to create a program to find N-th term of series 2, 12, 28, 50, 77, 112, 152, 198, …in C++.

Problem Description − To find the N-th term of the series.

2, 12, 28, 50, 77, 112, 152, 198, ...N terms

We will find a general for the series.

Let’s take an example to understand the problem,

Input − N = 6

Output − 112

## Solution Approach:

Here, the series is increasing in parabolic form, so the general term will be a quadratic equation.

So, the general formula for the series is

TN = 3*(N*N) + N - 2

## Program to illustrate the working of our solution,

#include <iostream>
using namespace std;
int findNTerm(int N) {
int nthTerm = ( (3*N*N) + N - 2);
return nthTerm;
}
int main()
{
int N = 10;
cout<<N<<"th term of the series is "<<findNTerm(N);
return 0;
}

## Output:

10th term of the series is 308

Updated on 03-Oct-2020 09:39:55