a=1
b=1
declare -a fi
echo ${fi[0]=$a}
echo ${fi[1]=$b}
let "n=a+b"
for((i=0;i<9;i++))
do
let "a=a+b"
echo ${fi[i*2+2]=$a}
let "b=b+a"
echo ${fi[i*2+3]=$b}
let "n+=a+b"
done
echo "sum is $n"
实现显示前20项的值和总和。
a=1
b=1
declare -a fi
echo ${fi[0]=$a}
echo ${fi[1]=$b}
let "n=a+b"
for((i=0;i<9;i++))
do
let "a=a+b"
echo ${fi[i*2+2]=$a}
let "b=b+a"
echo ${fi[i*2+3]=$b}
let "n+=a+b"
done
echo "sum is $n"
实现显示前20项的值和总和。