MENU
Question -

Write an algorithm that generates the fibbonacci series as:
1,1,2,3, 5,тАж. N terms.



Answer -

The algorithm as :

Step 1 : Begin.
Step 2 : Read N.
Step 3 : Let a = 1, b = 1 Step 4 : Print a, b.
Step 5 : ctr = 2.
Step 6 : c = a + b.
Step 7 : a = b.
Step 8 : b = c.
Step 9 : ctr = ctr + 1.
Step 10 : If ctr < N then repeat steps 6 to 9.
Step 11 : Stop.┬а

Comment(S)

Show all Coment

Leave a Comment

Free - Previous Years Question Papers
Any questions? Ask us!
×