- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

# C++ program to find n-th term in the series 7, 15, 32, …

In this problem, we are given an integer N. The task is to find n-th term in series 7, 15, 32....

**Let’s take an example to understand the problem,**

## Input

N = 6

## Output

281

## Explanation

The series upto nth term is 7, 15, 32, 67, 138, 281

## Solution Approach

The solution to the problem lies in decoding the series. You can see the series is a mix of series.

The subtracting the values,

T(2) - T(1) = 15 - 7 = 8 T(3) - T(2) = 32 - 15 = 17 So, T(2) = 2*T(1) + 1 T(3) = 2*T(2) + 2 T(n) = 2*T(n-1) + (n-1)

So, the value of the nth term is found using the last term. To find these we will loop from 1 to n and find each value of the series.

**Program to illustrate the working of our solution,**

## Example

#include <iostream> using namespace std; int findNthTerm(int n) { if (n == 1) return 7; int termN = 7; for (int i = 2; i <= n; i++) termN = 2*termN + (i - 1); return termN; } int main(){ int n = 12; cout<<"The series is 7, 15, 32, 67...

"; cout<<n<<"th term of the series is "<<findNthTerm(n); return 0; }

## Output

The series is 7, 15, 32, 67... 12th term of the series is 18419

- Related Questions & Answers
- Program to find N-th term of series 2, 4, 3, 4, 15… in C++
- C++ program to find n-th term of series 1, 3, 6, 10, 15, 21…
- Program to find N-th term of series 1 4 15 24 45 60 92... in C++
- Program to find N-th term in the given series in C++
- Program to find N-th term of series 7, 21, 49, 91, 147, 217, …… in C++
- Program to find N-th term of series 0, 2,1, 3, 1, 5, 2, 7, 3...in C++
- Program to find N-th term of series 0, 7, 8, 33, 51, 75, 102, 133...in C++
- C++ program to find n-th term in the series 9, 33, 73,129 …
- C Program for N-th term of Geometric Progression series
- C Program for N-th term of Arithmetic Progression series
- C++ program to find Nth term of the series 1, 5, 32, 288 …
- Program to find N-th term of series 3, 6, 18, 24, … in C++
- Program to find N-th term of series 1, 3, 12, 60, 360...in C++
- Java Program to Find sum of Series with n-th term as n^2 – (n-1)^2
- Python Program for Find sum of Series with the n-th term as n^2 – (n-1)^2

Advertisements