Monday, 13 February 2017

11C-19 Write a program to print Fibonacci series i.e.0 1 1 2 3 5 8………

11C-19 Write a program to print Fibonacci series i.e.0 1 1 2 3 5 8………

Algorithm:
Input:
1)n
Output:
1)fibonaci numbers 0 1 1 2 3 5 ...
Method:
1. Start
2. Read n
3. Print n
4. //logic
5. f1=0;
6. f2=1;
7. print f1 and f2
8. for(i=3;i<=n;i++)
   begin
     f3=f1+f2
     print f3
     f1=f2
     f2=f3
   end
9.stop

No comments:

Post a Comment