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

Trending Topics

Online now

Members online
1,063
Guests online
3,180
Total visitors
4,243

Forum statistics

Threads
2,330,108
Posts
29,252,019
Members
1,152,870
Latest member
chaoticmanbun
Back
Top