bash shell script fibonacci not showing value 2 after 0 1 1?

后端 未结 2 559
无人共我
无人共我 2021-01-26 08:13

I am writing a bash script for fibonacci which is not printing the value after 0 1 1 . It is not printing \"2\" after 0 1 1. The code is given below.

echo \"ent         


        
2条回答
  •  甜味超标
    2021-01-26 09:09

    echo "enter the number"
    read n
    a=0
    b=1
    c=0
    while [ $b -le $n ]
    do
      c=`expr $a + $b`
      echo $c ' = ' $a ' + '  $b
      a=$b
      b=$c
    done
    

提交回复
热议问题