- 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 2, 4, 3, 4, 15… in C++
- Program to find N-th term of series 0, 2,1, 3, 1, 5, 2, 7, 3...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!
- C++ program to find Nth term of the series 0, 2, 4, 8, 12, 18…
- 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 nth Term of the Series 1 2 2 4 4 4 4 8 8 8 8 8 8 8 8 …
- Program to find sum of series 1*2*3 + 2*3*4+ 3*4*5 + . . . + n*(n+1)*(n+2) in C++
- Sum of the series 2 + (2+4) + (2+4+6) + (2+4+6+8) + ... + (2+4+6+8+...+2n) in C++
- C++ program to find the sum of the series (1*1) + (2*2) + (3*3) + (4*4) + (5*5) + … + (n*n)
- C++ program to find n-th term of series 1, 3, 6, 10, 15, 21…
- Sum of the series 1 + (1+2) + (1+2+3) + (1+2+3+4) + ... + (1+2+3+4+...+n) in C++
- Program to find Sum of a Series a^1/1! + a^2/2! + a^3/3! + a^4/4! +…….+ a^n/n! in C++

- 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 0, 0, 2, 1, 4, 2, 6, 3, 8…in C++.

To find the Nth term of the given series−

0, 0, 2, 1, 4, 2, 6, 3, 8 .... N Terms

We will find the general term of the series.

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

N = 8

3

To find the general term of the series, we need to closely observe the series. This series is a bit difficult to recognize as it is a mixture of two series. One series at even positions and one series at odd positions.

Odd Series− 0, 2, 4, 6, 8, 10, 12,....

Even Series− 0, 1, 2, 3, 4, 5, 6,....

Here,

If the nth term of the series is

Odd, the value is (n-1).

Even, the value is $T_{(n-1)}/2$

#include using namespace std; int findNTerm(int N) { if (N % 2 == 0) return findNTerm(N-1)/2; else { return (N-1); } } int main(){ int N = 13; cout<<N<<"th term of the series is "<<findNTerm(N)<<endl; }

13th term of the series is 12

Advertisements