Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- echo Enter the fibboncci term
- read N
- i=3
- if [ $N -eq 1 ]
- then
- current=0
- elif [ $N -eq 2 ]
- then
- current=1
- fi
- below_prev=0
- prev=1
- current=0
- while [ $i -le $N ]
- do
- current=`expr $below_prev + $prev`
- below_prev=$prev
- prev=$current
- i=`expr $i + 1`
- done
- echo $N th term of sequence is $current
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement