Given first term (a), common difference (d) and a integer n of the Arithmetic Progression series, the task is to print the series.
Input : a = 5, d = 2, n = 10 Output : 5 7 9 11 13 15 17 19 21 23
We know the Arithmetic Progression series is like = 2, 5, 8, 11, 14 …. …
In this series 2 is the stating term of the series .
Common difference = 5 – 2 = 3 (Difference common in the series).
so we can write the series as :
t1 = a1
t2 = a1 + (2-1) * d
t3 = a1 + (3-1) * d
tn = a1 + (n-1) * d
2 3 4 5 6
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- PHP program to print an arithmetic progression series using inbuilt functions
- Program for N-th term of Arithmetic Progression series
- Longest Arithmetic Progression | DP-35
- Find the missing number in Arithmetic Progression
- Check whether Arithmetic Progression can be formed from the given array
- Count of AP (Arithmetic Progression) Subsequences in an array
- Minimum De-arrangements present in array of AP (Arithmetic Progression)
- Longest string in non-decreasing order of ASCII code and in arithmetic progression
- Longest arithmetic progression with the given common difference
- Ratio of mth and nth term in an Arithmetic Progression (AP)
- Convert given array to Arithmetic Progression by adding an element
- Arithmetic Progression
- Change one element in the given array to make it an Arithmetic Progression
- Check whether nodes of Binary Tree form Arithmetic, Geometric or Harmonic Progression
- Minimum elements inserted in a sorted array to form an Arithmetic progression
- Count common elements in two arrays which are in Arithmetic Progression
- Find the missing number in unordered Arithmetic Progression
- Count of subarrays forming an Arithmetic Progression (AP)
- Longest subarray forming an Arithmetic Progression (AP)
- Arithmetic Progression containing X and Y with least possible first term
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.