About Fibonacci series
Each new number in a series is addition of its previous two numbers.
Example of Fibonacci series(for N = 8)
0, 1, 1, 2, 3, 5, 8, 13
Algorithm to print Fibonacci series up to given number N.
Step 1: Start
Step 2: Declare variables N, N1, N2, N3, i.
Step 3: Read value of N from user.
Step 4: if N < 2, display message “Enter number > 2”
and go to step 9.
Step 5: Initialize variables N1 = 0, N2 = 1, i = 0
Step 6: Display N1, N2
Step 7: Compute N3 = N1 + N2
Step 8: Repeat following statements until i < N - 2
Display N3
N1 = N2
N2 = N3
N3 = N1 + N2
i = i + 1
Step 9: Stop
* * * * *
Nice post!!thanks for sharing good post. java vogue have good collection for improve program skill visit Programming Questions And Answers
ReplyDelete