Advertisement
GangBoss

Untitled

Oct 9th, 2019
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.31 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. if [ "$1" == "--help" ] || [ "$1" -lt 1 ] || [ "$1" == "-h" ]; then
  4. echo calculate fibunachi number for argument that bigger then 0 and less then 94
  5. exit
  6. fi
  7.  
  8. tmp=1
  9. result=0
  10.  
  11. for (( i=1; $i<$1; i++))
  12. do
  13.     let "result = result + tmp"
  14.     let "tmp = result - tmp"
  15. done
  16.  
  17. echo "$result"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement