shell脚本,求斐波那契数列的前10项及总和
cat shell
a=1
b=1
c=0
s=0
for((i=0; i<10; ++i));do
echo "$a"
let s+=a
let c=a+b
let a=b
let b=c
done
echo "sum=$s"
shell脚本,求斐波那契数列的前10项及总和
cat shell
a=1
b=1
c=0
s=0
for((i=0; i<10; ++i));do
echo "$a"
let s+=a
let c=a+b
let a=b
let b=c
done
echo "sum=$s"