fork download
  1. #!/bin/bash
  2.  
  3. echo "Enter the number of terms:"
  4. read n
  5.  
  6. a=0
  7. b=1
  8.  
  9. echo "Fibonacci series:"
  10. for ((i=0; i<n; i++)); do
  11. echo -n "$a "
  12. fn=$((a + b))
  13. a=$b
  14. b=$fn
  15. done
  16.  
Success #stdin #stdout 0.01s 5288KB
stdin
3
stdout
Enter the number of terms:
Fibonacci series:
0 1 1