❓ 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
  • 379
    Views
  • 1
    Participants
Last reply from:
Heathcliff

Trending Topics

Online now

Members online
1,202
Guests online
1,874
Total visitors
3,076

Forum statistics

Threads
2,293,166
Posts
29,082,100
Members
1,208,692
Latest member
meladrian18
Back
Top