- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- 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

# C++ program to find Nth term of the series 1, 6, 18, 40, 75, â€¦.

In this problem, we are given an integer N. Our task is to create a program to Find Nth term of series 1,6, 18, 40, 75 ...

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

## Input

N = 4

## Output

40

## Explanation

4^{th} term − (4 * 4 * 5 ) / 2 = 40

## Solution Approach

A simple approach to solve the problem is by using the general formula for the nth term of the series. The formula for,

Nth term = ( N * N * (N + 1) ) / 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 = 5; cout<<N<<"th term of the series is "<<calcNthTerm(N); return 0; }

## Output

5th term of the series is 75

Advertisements