Algorithm of Fibonacci Series

Step 1: START

Step 2: Declare variable a, b, sum, n, i

Step 2: Initialize variables: a = 0, b = 1, i = 2

Step 3:  Read n

Step 4: Repeat this step until

 i <= n:

sum = a + b

print sum a = b

b = sum

i = i + 1

Step 5: STOP

output:

Enter the number of elements:8

0 1 1 2 3 5 8 13

Leave a Reply

Your email address will not be published. Required fields are marked *