CBSE BOARD XII, asked by somil41, 10 months ago

write a programme in python to display fibonacci series upto a certain limit

Answers

Answered by moukshgogoi
2

Answer:

             n=int(input("Enter the number of terms required"))

             first=0

             second=1

             print(first)

             print(second)

             for a in range(1,n):

                    third=first+second

                    print(third)

                    first,second=second,third

Explanation:

Firstly the variable n takes the input from the user which is also the number of terms that the user wants.

We fix 2 terms 0 and 1 as the base .... and subsequently add them and then keep adding the consecutive terms.

The last line of the code swaps the values of every consecutive term.

Similar questions