- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

Given ‘a’ the First term, ‘r’ the common ratio and ‘n’ for the number of terms in a series. The task is to find the nth term of the series.

So, before discussing how to write a program for the problem first we should know what is Geometric Progression.

Geometric progression or Geometric sequence in mathematics are where each term after the first term is found by multiplying the previous one with the common ratio for a fixed number of terms.

Like 2, 4, 8, 16, 32.. is a geometric progression with first term 2 and common ratio 2. If we have n = 4 then the output will be 16.

So, we can say that Geometric Progression for nth term will be like −

GP1 = a1 GP2 = a1 * r^(2-1) GP3 = a1 * r^(3-1) . . . GPn = a1 * r^(n-1)

So the formula will be GP = a * r^(n-1).

Input: A=1 R=2 N=5 Output: The 5th term of the series is: 16 Explanation: The terms will be 1, 2, 4, 8, 16 so the output will be 16 Input: A=1 R=2 N=8 Output: The 8^{th}Term of the series is: 128

**Approach we will be using to solve the given problem** −

- Take first term A, common ratio R, and N the number of series.
- Then calculate nth term by A * (int)(pow(R, N - 1).
- Return the Output obtained from the above calculation.

Start Step 1 -> In function int Nth_of_GP(int a, int r, int n) Return( a * (int)(pow(r, n - 1)) Step 2 -> In function int main() Declare and set a = 1 Declare and set r = 2 Declare and set n = 8 Print The output returned from calling the function Nth_of_GP(a, r, n) Stop

#include <stdio.h> #include <math.h> //function to return the nth term of GP int Nth_of_GP(int a, int r, int n) { // the Nth term will be return( a * (int)(pow(r, n - 1)) ); } //Main Block int main() { // initial number int a = 1; // Common ratio int r = 2; // N th term to be find int n = 8; printf("The %dth term of the series is: %d\n",n, Nth_of_GP(a, r, n) ); return 0; }

The 8th term of the series is: 128

- Related Questions & Answers
- C Program for N-th term of Arithmetic Progression series
- C program to compute geometric progression
- Program for sum of geometric series in C
- Program to find N-th term in the given series in C++
- How to create geometric progression series in R?
- Python Program for Find sum of Series with the n-th term as n^2 – (n-1)^2
- Program to find N-th term of series 1, 3, 12, 60, 360...in C++
- Program to find N-th term of series 3, 6, 18, 24, … in C++
- C++ program to find n-th term of series 3, 9, 21, 41, 71…
- C++ program to find n-th term of series 2, 10, 30, 68, 130 …
- Program to find N-th term of series a, b, b, c, c, c…in C++
- n-th term of series 1, 17, 98, 354…… in C++
- C++ program to find n-th term in the series 7, 15, 32, …
- C++ program to find n-th term in the series 9, 33, 73,129 …
- C/C++ Program to Find sum of Series with n-th term as n power of 2 - (n-1) power of 2

Advertisements