The first two terms in the Fibonacci series are 0 and 1, respectively, and each subsequent term is the sum of the previous two. Using this definition, to calculate the first several terms in the sequence, we get: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... Build an algorithm for the same.
Answers
Answered by
36
Step-by-step explanation:
- Start
- Input Value of n from user
- Declare the values of a=0, b=1, count=1
- Write a, b
- If (count >n) then go to step 12
- next = a+b
- Write next
- a=b
- b=next
- count=count + 1
- Go to step 4
- Stop
Similar questions