![]() |
Arithmetic progression is a sequence of numbers in which the difference between any two consecutive terms is always equal. This difference between any two consecutive terms is known as a common difference and it can be positive, negative or zero. The nth term of A.P. in mathematics is calculated by using the nth term formula which is described as follows: Syntax:an = a + (n-1) × d Parameters:
Example: To demonstrate finding the the nth terms in the A.P. series using the function which uses the nth term formula to calculate the nth terms of an A.P, series to print the result.
Output The 15-th term of the arithmetic progression is: 44 Time Complexity : O(1) , constant time Space Complexity : O(1), constant space |
Reffered: https://www.geeksforgeeks.org
JavaScript |
Type: | Geek |
Category: | Coding |
Sub Category: | Tutorial |
Uploaded by: | Admin |
Views: | 13 |