- C++ Basics
- C++ Home
- C++ Overview
- C++ Environment Setup
- C++ Basic Syntax
- C++ Comments
- C++ Data Types
- C++ Variable Types
- C++ Variable Scope
- C++ Constants/Literals
- C++ Modifier Types
- C++ Storage Classes
- C++ Operators
- C++ Loop Types
- C++ Decision Making
- C++ Functions
- C++ Numbers
- C++ Arrays
- C++ Strings
- C++ Pointers
- C++ References
- C++ Date & Time
- C++ Basic Input/Output
- C++ Data Structures

- C++ Object Oriented
- C++ Classes & Objects
- C++ Inheritance
- C++ Overloading
- C++ Polymorphism
- C++ Abstraction
- C++ Encapsulation
- C++ Interfaces

# 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 Articles
- 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…
- Find the Nth term of the series 9, 45, 243,1377…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 …
- Find the Nth term of the series 14, 28, 20, 40,….. using 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…
- C++ program to find nth term of the series 5, 2, 13 41,...
- Find the Nth term of the series where each term f[i] = f[i – 1] – f[i – 2] 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…
- Program to find N-th term of series 0, 0, 2, 1, 4, 2, 6, 3, 8…in C++
- JavaScript code to find nth term of a series - Arithmetic Progression (AP)

Advertisements