- 2

Guyz can't stuck at this ?

3. Calculate the arithmetic sequence of n numbers. The program will generate the nth term of the sequence, whereas the user will enter the first term and the common difference. Example: you have entered the first term as 3 and common difference 6 you are interesting in 35 term. So it will calculate and generate the answer as 207. anat (n-1)d

4th Dec 2021, 9:28 AM
SAfiullaH KhoKhar
SAfiullaH KhoKhar - avatar
9 ответов
+ 1
# Hi! Your almost there! # an = a0 + d*(n - 1) # a0 = 3, d = 6 -> a35 = 3 + 6*(35 - 1) = 207 # Just write a function to put the formula in!
4th Dec 2021, 12:38 PM
Per Bratthammar
Per Bratthammar - avatar
+ 1
Really appreciate brother many many thanks.
4th Dec 2021, 12:39 PM
SAfiullaH KhoKhar
SAfiullaH KhoKhar - avatar
+ 1
Rit Wittkopp he wrote it wrong n + (n - 1)d 35 + (35- 1)6
4th Dec 2021, 1:15 PM
Jamari McFarlane
Jamari McFarlane - avatar
0
SAfiullaH KhoKhar Hi buddy Call me dumb, but I don't understand how you get 207 from the first 2 inputs of 3 & 6. Could you break it down for us please.
4th Dec 2021, 12:42 PM
Rik Wittkopp
Rik Wittkopp - avatar
0
Brother there's a formula to find the nth term
4th Dec 2021, 12:51 PM
SAfiullaH KhoKhar
SAfiullaH KhoKhar - avatar
0
a=2+6(n-1)
4th Dec 2021, 12:51 PM
SAfiullaH KhoKhar
SAfiullaH KhoKhar - avatar
0
a=6n-4
4th Dec 2021, 12:52 PM
SAfiullaH KhoKhar
SAfiullaH KhoKhar - avatar
0
Our nth term is 35 like mentioned in the question so, a=6*35-4 206 is the answer.
4th Dec 2021, 12:53 PM
SAfiullaH KhoKhar
SAfiullaH KhoKhar - avatar
0
Your question formation is wrong first you asked for nth term but you wanted to print the value in the nth term both are different. a=int(input(Enter the first term:)) d=int(input(Enter the common difference:)) n=int(input(Enter the nth term value you want)) Ap=a+((n-1)*d) Print(Ap)
6th Dec 2021, 9:15 AM
Krishna Jayanth
Krishna Jayanth - avatar