1. 程式人生 > >shell程式設計斐波那契函式

shell程式設計斐波那契函式

輸入數字得到對應的斐波那契數列

例如:

10

1  1  2  3  5  8  13  21  34  55

echo -n "please enter your want number:"
read n
first=0
second=0
third=0
for((I=1;i<=n;i++))
do 
    echo -n $third " "
    let first=$second
    let second=$third
    let third=$second+$first
done
echo