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

猜你喜欢

转载自blog.csdn.net/qq_36480179/article/details/82422498
今日推荐