main

an anonymous user · June 24, 2022
 echo "How many number of terms to be generated ?"
  read n

  x=0
  y=1
  i=2
  echo "Fibonacci Series up to $n terms :"
  echo "$x"
  echo "$y"
  while [ $i -lt $n ]
  do
      i=`expr $i + 1 `
      z=`expr $x + $y `
      echo "$z"
      x=$y
      y=$z
  done
Output
(Run the program to view its output)

Comments

Please sign up or log in to contribute to the discussion.