- 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

# Program to find N-th term of series 1 4 15 24 45 60 92... in C++

In this problem, we are given a number N. Our task is to create a program to find N-th term of series 1 4 15 24 45 60 92... in C++.

**Problem description** − To find the nth term of the series −

1, 4, 15, 24, 45, 60, 92, 112 … N terms

We will find the general formula for the series.

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

**Input** − N = 6

**Output** − 60

## Solution Approach,

The general term of the series is based on whether the value of N is even or odd. This type of series is a bit complex to recognize but once you think of series as two different for even and odd, it is quite easy to find the general term.

The general term is −

T_{N}= ((2 * (N^2)) - N), if n is odd. T_{N}= (2 * ((N^2) - N)), if n is even.

## Program to illustrate the working of our solution,

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

## Output:

10th term of the series is 180

- Related Questions & Answers
- Program to find N-th term of series 2, 4, 3, 4, 15… in C++
- Program to find N-th term of series 1, 3, 12, 60, 360...in C++
- C++ program to find n-th term of series 1, 3, 6, 10, 15, 21…
- C++ program to find Nth term of series 1, 4, 15, 72, 420…
- C++ program to find n-th term of series 1, 4, 27, 16, 125, 36, 343...
- Program to find N-th term of series 3, 6, 18, 24, … in C++
- C++ program to find n-th term in the series 7, 15, 32, …
- Program to find N-th term of series 9, 23, 45, 75, 113… in C++
- Program to find N-th term of series 0, 10, 30, 60, 99, 150, 210, 280...in C++
- C++ Programe to find n-th term in series 1 2 2 3 3 3 4
- Program to find N-th term of series 0, 9, 22, 39, 60, 85, 114, 147, …in C++
- Program to find N-th term of series 0, 0, 2, 1, 4, 2, 6, 3, 8…in C++
- C++ program to find Nth number of the series 1, 6, 15, 28, 45, …..
- C++ program to Find Nth term of the series 1, 1, 2, 6, 24…
- Java Program to Find sum of Series with n-th term as n^2 – (n-1)^2

Advertisements