
- 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
C++ program to find Nth term of the series 0, 2, 4, 8, 12, 18…
In this problem, we are given an integer N. Our task is to create a program to Find Nth term of series 0, 2, 4, 8, 12, 18…
Let’s take an example to understand the problem,
Input
N = 5
Output
12
Solution Approach
A simple approach to solve the problem is the formula for the Nth term of the series. For this, we need to observe the series and then generalise the Nth term.
The formula of Nth term is
T(N) = ( N + (N - 1)*N ) / 2
Program to illustrate the working of our solution,
Example
#include <iostream> using namespace std; int calcNthTerm(int N) { return (N + N * (N - 1)) / 2; } int main() { int N = 10; cout<<N<<"th term of the series is "<<calcNthTerm(N); return 0; }
Output
10th term of the series is 50
- Related Articles
- 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 given series 0, 0, 2, 1, 4, 2, 6, 3, 8, 4… in C++
- 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, 6, 18, 40, 75, ….
- Find the nth term of the series 0, 8, 64, 216, 512,... in C++
- C++ program to find Nth term of the series 1, 8, 54, 384…
- C++ program to find nth term of the series 5, 2, 13 41,...
- C++ program to get the Sum of series: 1 – x^2/2! + x^4/4! -…. upto nth term
- C++ program to find Nth term of series 1, 4, 15, 72, 420…
- C++ program to Find Nth term of the series 1, 1, 2, 6, 24…
- 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…
- Program to find N-th term of series 2, 4, 3, 4, 15… in C++
- C++ program to find Nth term of the series 5, 13, 25, 41, 61…
- Program to find N-th term of series 1, 2, 11, 12, 21… in C++

Advertisements