Computer Science, asked by ayush28717, 8 months ago

(Python)

Q. What is Fibonacci Sequence?
Also, Explain this code related to it.

n = int(input())

f1 = f2 = 1
print(f1, f2, end=' ')

i = 2
while i < n:
f1, f2 = f2, f1+f2
print(f2, end=' ')
i += 1

print()​

Answers

Answered by divyanshtiwarivk
0

Answer:

you have a great time and I

Answered by Anonymous
1

Answer:

Hi...

Explanation:

A Fibonacci series is a series in which the next number is formed after the addition of its proceeding two numbers..

I think you can understand it in a much better way after seeing the series..

0,1,1,2,3,5...

Next coming to your program ..

Here you are inputting some number and in that range you are finding the Fibonacci series...

In your program you have assigned the value of first and the second digit as 1 ..and then printing it...

And then you are assigning i value as 2.. and then with the help of while loop you are saying that the loop should be executed till the value of i is less than the number which you have assigned in the starting then your next step you are assigning the value of first number as second and the second number as first + second ..and in the next statement you are printing the value of second number and then adding 1 to the existing value of i...

And then finally printing the whole series...

____________end________

Hope it helps you

Please mark brainliest

Similar questions