

- 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
Find the nth term of the series 0, 8, 64, 216, 512,... in C++
In this problem, we are given an integer value N. Our task is to find the nth term of the series −
0, 8, 64, 216, 512, 1000, 1728, 2744…
Let’s take an example to understand the problem,
Input: N = 6 Output: 1000
Solution Approach
To find the Nth term of the series, we need to closely observe the series. The series is the cube of even numbers, where the first term is 0.
So, the series can be decoded as −
[0]3, [2]3, [4]3, [6]3, [8]3, [10]3…
For ith term,
T1 = [0]3 = [2*(1-1)]3
T2 = [2]3 = [2*(2-1)]3
T3 = [4]3 = [2*(3-1)]3
T4 = [6]3 = [2*(4-1)]3
T5 = [8]3 = [2*(5-1)]3
So, the Nth term of the series is { [2*(N-1)]3 }
Example
Program to illustrate the working of our solution
#include <iostream> using namespace std; long findNthTermSeries(int n){ return ((2*(n-1))*(2*(n-1))*(2*(n-1))); } int main(){ int n = 12; cout<<n<<"th term of the series is "<<findNthTermSeries(n); return 0; }
Output
12th term of the series is 10648
- Related Questions & Answers
- C++ program to find Nth term of the series 0, 2, 4, 8, 12, 18…
- 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, 8, 54, 384…
- C++ program to find nth Term of the Series 1 2 2 4 4 4 4 8 8 8 8 8 8 8 8 …
- Find the Nth term of the series 9, 45, 243,1377…in C++
- Find the Nth term of the series 14, 28, 20, 40,….. using C++
- C++ program to find nth term of the series 5, 2, 13 41,...
- Program to find N-th term of series 0, 0, 2, 1, 4, 2, 6, 3, 8…in C++
- C++ program to find Nth term of the series 1, 5, 32, 288 …
- C++ program to find Nth term of the series 3, 14, 39, 84…
- Find nth term of the Dragon Curve Sequence in C++
- Program to find N-th term of series 0, 7, 8, 33, 51, 75, 102, 133...in C++
- C++ program to Find Nth term of the series 1, 1, 2, 6, 24…
- C++ program to find Nth term of the series 1, 6, 18, 40, 75, ….
- C++ program to find Nth term of the series 5, 13, 25, 41, 61…
Advertisements