Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
17
Task/Anonymous-recursion/UNIX-Shell/anonymous-recursion-1.sh
Normal file
17
Task/Anonymous-recursion/UNIX-Shell/anonymous-recursion-1.sh
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
fib() {
|
||||
if test 0 -gt "$1"; then
|
||||
echo "fib: fib of negative" 1>&2
|
||||
return 1
|
||||
else
|
||||
(
|
||||
fib2() {
|
||||
if test 2 -gt "$1"; then
|
||||
echo "$1"
|
||||
else
|
||||
echo $(( $(fib2 $(($1 - 1)) ) + $(fib2 $(($1 - 2)) ) ))
|
||||
fi
|
||||
}
|
||||
fib2 "$1"
|
||||
)
|
||||
fi
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue