- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- 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 3, 5, 33, 35, 53… in C++
In this tutorial, we will be discussing a program to find N-th term of series 3, 5, 33, 35, 53…
For this, we will be provided with a number. Our task is to find the term for the given series at that particular position.
Example
#include <bits/stdc++.h> using namespace std; //finding the nth term in the series int printNthElement(int n){ int arr[n + 1]; arr[1] = 3; arr[2] = 5; for (int i = 3; i <= n; i++) { if (i % 2 != 0) arr[i] = arr[i / 2] * 10 + 3; else arr[i] = arr[(i / 2) - 1] * 10 + 5; } return arr[n]; } int main(){ int n = 6; cout << printNthElement(n); return 0; }
Output
55
- Related Articles
- C++ program to find n-th term in the series 9, 33, 73,129 …
- Program to find N-th term of series 3 , 5 , 21 , 51 , 95 , … 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++
- Program to find N-th term of series 3, 6, 18, 24, … in C++
- C++ program to find n-th term of series 3, 9, 21, 41, 71…
- Program to find N-th term of series 1, 3, 12, 60, 360...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, 12, 29, 54, 87, … 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++
- C++ program to find n-th term in the series 7, 15, 32, …
- Program to find N-th term of series a, b, b, c, c, c…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 3, 12, 29, 54, 86, 128, 177, 234, ….. in C++

Advertisements