Q. How do I print fibonacci series in Bash
Ans:
#!/bin/bash c=0 a=1 b=1 read -p "Enter limit of fibonacci Series:" n echo -n "$a " echo -n "$b " #Fibonacci series logic while((c<n)) do c=$((a+b)) echo -n "$c " a=$b b=$c done echo -e "\n"
Output
Enjoy :)
If You Liked This Post Please Take a Time To Share This Post
0 comments:
Post a Comment