Created
April 8, 2017 13:30
-
-
Save lazyakshay/412bfa813ec6291afda130381d7cadc5 to your computer and use it in GitHub Desktop.
shell script to generate fibonacci series
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
c=2 | |
a=1 | |
b=1 | |
d=0 | |
echo "enter the number of elements" | |
read n | |
echo "$a" | |
echo "$b" | |
while((c<n)) | |
do | |
d=$((a+b)) | |
echo "$d" | |
a=$b | |
b=$d | |
c=$((c+1)) | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment