- 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 a, b, b, c, c, c…in C++.

To find the Nth term of the series −

**a, b, b, c, c, c, d, d, d, d,....Nterms **

We need to find the general term of the series.

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

Input

N = 7

Output

d

To find the general term of the series, we need to closely observe the series. The series has 1 a, 2 b’s, 3 c’s, 4 d’s,... This seems to be an AP. And the Nth term is the sum of AP which a and d both 1.

Sum of AP = Nth Term = (n/2)(a+(n-1)d).

The n specifies which character is the Nth term.

Now, lets derive the value of n,

Nth Term = (n/2)*(1 + (n-1)*1) (n/2)*(1 + n - 1) (n/2)*n

$\sqrt{2\square^2}$

#include <iostream> #include <math.h> using namespace std; char findNTerm(int N) { int n = sqrt(2*N); return ((char)('a' + n)); } int main() { int N = 54; cout<<N<<"th term of the series is "<<findNTerm(N); return 0; }

54th term of the series is k

- Related Questions & Answers
- C++ program to find n-th term in the series 7, 15, 32, …
- C++ program to find n-th term in the series 9, 33, 73,129 …
- Program to find N-th term of series 3, 6, 18, 24, … in C++
- n-th term of series 1, 17, 98, 354…… in C++
- C++ program to find n-th term of series 3, 9, 21, 41, 71…
- C++ program to find n-th term of series 2, 10, 30, 68, 130 …
- Program to find N-th term of series 7, 21, 49, 91, 147, 217, …… in C++
- Program to find N-th term of series 3, 5, 33, 35, 53… in C++
- Program to find N-th term of series 1, 2, 11, 12, 21… in C++
- Program to find N-th term of series 2, 4, 3, 4, 15… in C++
- Program to find N-th term of series 3 , 5 , 21 , 51 , 95 , … in C++
- Program to find N-th term of series 3, 12, 29, 54, 87, … in C++
- Program to find N-th term of series 9, 23, 45, 75, 113… in C++
- C++ program to find n-th term of series 1, 3, 6, 10, 15, 21…
- Program to find N-th term in the given series in C++

Advertisements