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
c=$((a+b))
echo -n "$c "
a=$b
b=$c
done
echo -e "\n"
Output
Enjoy :)
The Magician Of Linux
0 comments:
Post a Comment