Welcome To Home of Information

Write a MATLAB program which prints the Fibonacci series using loop. 1 1 2 3 5 8 13 21 34 …

Posted in
No comments
Wednesday, July 30, 2014 By Anonymous



Write a MATLAB program which prints the Fibonacci series using loop.
1 1 2 3 5 8 13 21 34 …
Solution:

function QUESTION3()                                %Function start
start=input('ENTER STARTING NO: ');                 %Input starting no of  Fiboonaci
END=input('ENTER ENDING NO: ');                    %How many Terms Required
next=start;
disp(start);
for n=start:END                                            %Loop start to end 
    disp(next);                                     %Display the series
    temp=next+start;
    start=next;
    next=temp;
end                                                      %END For loop
end                                                      %END Function

Related posts

0 comments:

About the Author

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque volutpat volutpat nibh nec posuere. Donec auctor arcut pretium consequat.

Proudly Powered by Blogger.