Given a first element a and common difference d of an arithmetic progression. Write a program to find the nth term in that progression.
An arithmetic progression or arithmetic sequence is a sequence of numbers such that the difference between the consecutive terms is constant. For instance, the sequence 5, 7, 9, 11, 13, 15, . . . is an arithmetic progression with a common difference of 2.
a = 1, d = 2, n = 5 output: 9 a = 2, d = 5, n = 4 output: 17
The formula for finding the nth term in an arithmetic progression:
Nth term = a + (n-1)*d.
a = 1, d = 2, n = 5 5th term: 9 a = 2, d = 5, n = 4 4th term: 17
Also read: Find the Arithmetic Progression sequence