Nth Term In  An Arithmetic Progression

Introduction

Arithmetic Progression (AP) is a sequence of numbers in which the difference between consecutive terms remains constant. One common task in AP is finding the Nth term, which allows us to determine the value of any term in the sequence. In this article, we will explore an iterative approach to finding the Nth term in an Arithmetic Progression. We will discuss the understanding, approach, step-by-step solution, and provide sample code to illustrate the process.



Understanding Arithmetic Progression

Arithmetic Progression is a sequence of numbers in which the difference between consecutive terms, known as the common difference, remains constant. Each term can be obtained by adding the common difference to the previous term. The Nth term represents the value of the term at position N in the sequence.



Approach

To find the Nth term in an Arithmetic Progression using iteration, we can start with the first term and repeatedly add the common difference until we reach the desired position N.



Step-by-Step Solution

a. Add the common difference (d) to the current term (currentTerm). 

b. Update the current term with the new value.


Code

Here's an example implementation:

Conclusion

By using an iterative approach, we can easily find the Nth term in an Arithmetic Progression. The process involves initializing the first term, iterating through the sequence by adding the common difference, and updating the current term until we reach the desired position. The code provided demonstrates a simple implementation, allowing you to find the Nth term in any Arithmetic Progression. Understanding this iterative approach enables us to solve various problems involving Arithmetic Progressions effectively.


Exercise: 

Calculate Nth term in an AP using the formula and validate if both the approaches gives same result.