SOURCE CODE:
echo "Enter the number"
read n
i=1
a=-1
fib=0
b=1
echo "Fibonacci series is"
while [ $i -lt $n ]
do
fib=`expr $a + $b`
a=$b
b=$fib
echo $fib
i=`expr $i + 1`
done
OUTPUT:
[examuser35@localhost Jebastin]$ sh fib.sh
Enter the number
8
Fibonacci series is
0
1
1
2
3
5
8
EmoticonEmoticon