Welcome To baselogics.blogspot.in

Jasper Roberts - Blog

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
















5 comments:

  1. This is prof that diagrams can be useful when it comes to programming. Specially flowcharts are the best way to plan a programs flow

    ReplyDelete
  2. A Computer Science portal for geeks. It contains well written, well thought and well
    explained computer science and programming articles, quizzes and practice/competitive
    programming/company interview Questions.
    website: geeksforgeeks.org

    ReplyDelete
  3. A Computer Science portal for geeks. It contains well written, well thought and well
    explained computer science and programming articles, quizzes and practice/competitive
    programming/company interview Questions.
    website: geeksforgeeks.org

    ReplyDelete

Your Suggestions and Reviews are valuable to us to make this blog better........