Welcome To baselogics.blogspot.in

Welcome to baselogics.blogspot.com

Place to Learn Programmes.

Bits and Bytes....

Computer Scientists Love Their Algorithms and Data Structures

Explore all new Mathematical Puzzles......

Jasper Roberts - Blog
Showing posts with label Fibbonacci series Algorithm with Flowchart. Show all posts
Showing posts with label Fibbonacci series Algorithm with Flowchart. Show all posts

Saturday, September 6, 2014

Fibbonacci series Algorithm with Flowchart

              We all know fibbonacci sequence (for eg 1,1,2,3,5,8,13,....  sequence in which next no is addition of previous 2 fibonacci numbers) so we will try to write algorithm to generate fibbonacci sequence . 
F1=1st number, F2=2nd number -->F3=f1+f2=1+2=3 F4=f2+f3=2+3=5 F5=f3+f4=3+5=8, and so on. f1 f2 f3 f4 f5 f6 f7.............. 1 2 3 5 8 13 21............. 
In algorithm: 
1. Assign sum=0, A=0, B=1, i=1 
2. Get the no. of terms upto which u want to generate the Fibonacci no, i.e., n. 
3.Add A and B to get the next Fibonacci number 
4. Assign the value of B to A i.e. A=B 
5. Assign the value of sum to B i.e. B=sum 
6. Write the value of su to get next Fibonacci number in the series. 
7. increment i with 1 i.e. i=i+1 and repeat step 3,4,5,6 with the last value of i=n(n is the no. of terms which u wnt to generate Fibonacci no. series.) 
8. Stop