Computer Science, asked by sakshimishra5362, 4 months ago

write an algorithm to find the fibonacci series till term≤1000

Answers

Answered by swamikukkar
1

Answer:

mark me as the brainliest

Explanation:

mark me down as the brainliest

Answered by tkdsawwalakhe01
0

Answer:

a = 1

b = 1

n = 1000 # Set this to however many terms you want to generate

series = [1, 1]

for x in range(2, n):

   next = series[x - 1] + series[x - 2]

   series.append(next)

   

print(series)

Explanation:

What I have done here is set up a for loop in range(2, n) . Since n is equal to 20 in this example, the for loop loops for each x in the interval [2, n]. Indented inside the loop is our definition of the Fibonacci sequence: that each term is the sum of the 2 terms preceding it. Finally, the loop appends that term to the list series .

Similar questions