blob: 0e73efa02be1138d0302f680e2ef41dc233c96fa (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
//Chapter 05: Induction and Recursion
clc;
clear;
function f = my_f(n)
if n == 0
f = 3
else
f = 2* my_f(n-1) +3 //making a recursive call
end
return f
endfunction
for n=0:4
re=my_f(n)
mprintf("The value of f(%d) is %d\n",n,re)
end
|