Saturday 10 November 2012

Write a shell script program to print the fibonacci series

 --Fibonacci Series

echo fibonacci series
echo how many terms u want to print
read n
a=0
b=1
count=0
echo fibbonaci series is
echo $a
echo $b
n=`expr $n - 2`
while [ $count -lt $n ]
do
c=`expr $b + $a`
echo $c
a=`expr $b`
b=`expr $c`
count=`expr $count + 1`
done

4 comments:

  1. I think it is better than other
    , easy to understood.

    ReplyDelete
  2. its not working..... error showing in line 8

    ReplyDelete
  3. It doesn't work as it shows off nos rather than fibonaaci series

    ReplyDelete