-
-
Save DevOps-Emre/9fb3d5e923111672b6219b0bc6e0e6b2 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