|
| From: | naruto canada |
| Subject: | is this a bug? |
| Date: | Wed, 14 Nov 2007 05:26:44 +0000 |
function fact {
local n=$1
if [ "$n" -eq 0 ]; then
return 1
else
fact $(( $n - 1 ))
return $(( $n * $? ))
fi
}
for i in `seq 0 11`; do
fact $i ; echo $?
done
1
1
2
6
24
120
208
176
128
128
0
0
the results are wrong for 6 and above.
is this a bug?
| [Prev in Thread] | Current Thread | [Next in Thread] |