# Program to find N-th term of series 2, 4, 3, 4, 15… in C++

C++Server Side ProgrammingProgramming

In this tutorial, we will be discussing a program to find N-th term of series 2, 4, 3, 4, 15…

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

Live Demo

#include <iostream>
using namespace std;
//calculating nth term of given series
int nthTerm(int N) {
return (N * ((N % 2) + (N % 3)));
}
int main() {
int N = 5;
cout << "Nth term = "
<< nthTerm(N);
return 0;
}

## Output

Nth term = 15
Published on 15-May-2020 16:40:55