- 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
Program to find N-th term of series 3, 12, 29, 54, 86, 128, 177, 234, ….. in C++
In this tutorial, we will be discussing a program to find N-th term of series 3, 12, 29, 54, 86, 128, 177, 234, …..
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
#include <iostream> #include <math.h> using namespace std; //calculating nth term of given series int nthTerm(int n) { return 4 * pow(n, 2) - 3 * n + 2; } int main() { int N = 4; cout << nthTerm(N) << endl; return 0; }
Output
54
Advertisements