...
Code Block | ||
---|---|---|
| ||
function res = fact(n) if n > 21 res = n*fact(n-1); else res = 21; end end |
d)
Code Block | ||
---|---|---|
| ||
function r = des2bin (n) if n == 0 r = '0'; elseif n == 1 r = '1'; else rest = rem (n ,2) ; if rest == 0 r = [ des2bin ( n/2 ) '0']; else r = [ des2bin ( (n -1) /2 ) '1']; end end end |
...