- 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

In this problem, we are given a number N. Our task is to create a program to find N-th term of series 2, 4, 3, 4, 15… in C++.

**Problem Description** − To find the sum of the given series,

**2, 4, 3, 4, 15, 0, 14, 16 .... N terms**

We will find the formula for the general term of the series.

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

**Input** − N = 9

**Output** − 9

The increase of the values in the series is linear i.e. no square values are in the series. Also, it’s value depends on other factors too (division by 2 and 3, as 6 gives 0).

So, we will first take out N (i.e. 1, 2, 3) from their value from the series.

Series: 1*(2), 2*(2), 3*(1), 4*(1), 5*(3), 6*(0), …

On observing this we can deduct the general formula is −

**T _{n} = ( N*((N%2)+(N%3)) )**

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

10th term of the series is 10

- Related Questions & Answers
- 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, 0, 2, 1, 4, 2, 6, 3, 8…in C++
- C++ Program to find the sum of a Series 1/1! + 2/2! + 3/3! + 4/4! + …… n/n!
- C++ program to find the sum of the series 1/1! + 2/2! + 3/3! + 4/4! +…….+ n/n!
- Python Program to find the sum of a Series 1/1! + 2/2! + 3/3! + 4/4! +…….+ n/n!
- Java Program to find the sum of a Series 1/1! + 2/2! + 3/3! + 4/4! +…….+ n/n!
- C++ program to find n-th term of series 1, 3, 6, 10, 15, 21…
- C++ program to find the sum of the series (1*1) + (2*2) + (3*3) + (4*4) + (5*5) + … + (n*n)
- Program to find sum of series 1*2*3 + 2*3*4+ 3*4*5 + . . . + n*(n+1)*(n+2) in C++
- C++ program to find Nth term of series 1, 4, 15, 72, 420…
- Program to find Sum of a Series a^1/1! + a^2/2! + a^3/3! + a^4/4! +…….+ a^n/n! in C++
- Program to find N-th term of series 1 4 15 24 45 60 92... in C++
- C++ program to find n-th term in the series 7, 15, 32, …
- Find the nth term of the given series 0, 0, 2, 1, 4, 2, 6, 3, 8, 4… in C++
- C++ program to find nth Term of the Series 1 2 2 4 4 4 4 8 8 8 8 8 8 8 8 …

Advertisements