❓ Help fibonacci matlab

Status
Not open for further replies.
Hello sino po nagmamatlab dito di ko po kasi makuha kung paano palabasin ang first 10 digits ng fibonacci without loops
eto po ung code na ginawa ko
f = zeros(10,1);
f(1)=1;
f(2)=1;
n=(3:10);
f(n)= f(n-2)+f(n-1);
disp(f)
kaso eto po ung result
1 1 2 1 0 0 0 0 0 0
nakuha ko naman po siya pag may for loop with this
F = [ ];
F(1) = 1;
F(2) = 1;
for n=3:10
F(n) = F(n-1) + F(n-2);
end
disp(F)
need ko rin po kasi ung walang loop
 
Status
Not open for further replies.

About this Thread

  • 0
    Replies
  • 391
    Views
  • 1
    Participants
Last reply from:
Heathcliff

Trending Topics

Online now

Members online
1,078
Guests online
6,949
Total visitors
8,027

Forum statistics

Threads
2,354,263
Posts
29,382,959
Members
1,079,394
Latest member
vhenz
Back
Top