blob: 65cbf0d7e84ae6c0d11a35db229f10ced43befa1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
function[fib]=fibbo(n)
fib=-1;
if(n<0)
disp("Invalid Entry");
else
if(n<=1)
fib=n;
else
fib=fibbo(n-1)+fibbo(n-2);
end
end
endfunction
function[l]=fibbon(n)
x=0;
l=(fibbo(0));
for x=1:n-1
l=[l(:,:),fibbo(x)];
end
disp(l);
endfunction
//Calling Routine:
n=5;
l=fibbon(n)
|