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

Trending Topics

Online now

Members online
1,121
Guests online
3,426
Total visitors
4,547

Forum statistics

Threads
2,306,734
Posts
29,173,940
Members
1,194,018
Latest member
Unmenacee
Back
Top