Given the first and second term of an arithmetic progression, print the first n terms of the AP.
Note:
> nth term in an AP = First Term + (n-1)*(Common Difference), where Common Difference is same for all the terms
> no extra knowledge about Progression is required for this task. What is given is sufficient.
Example:
Input:
a1=2 (first term),
a2=7 (second term),
n=6 (number of terms of the AP to print)
Output:
27 12 17 22 27
please help me
Answers
Answered by
0
a = 2 #first term
b = 7 # second term
d = b-a (common difference)
l = [a+5d,a+4d,a+3d,a+2d,a+d,a]
for i in l:
print(I,end=" ")
SO THAT THE OUTPUT
MARK ME AS BRAINLY*
Similar questions