Monday, 10 December 2018

Algorithm for generation of Fibonacci Series( n numbers )


Generation of Fibonacci Series:
Algorithm for generation of Fibonacci Series( n numbers ):
Step1  :   Start
Step2  :   Declare three variables a, b and c
Step3  :   Declare n and I
Step4  :   Read number of terms n from keyboard
Step5  :   Assign values a =0 , b=1 and c =0, I =1
Step6  :   Print the value of a
Step7  :   Assign value of b into a
Step8  :   Assign value of c into b
Step9  :   Assign the sum of a and b to c
Step10:   Print c
Step11:   Increment I by 1
Step12:   Repeat steps 6 to 10 until I <= n-1
Step13:   Stop



No comments:

Post a Comment