31 December 2011

Program in UNIX to generate Fibonacci series

$ cat>fibonacci.sh
echo enter value of n
read n
A = 0
B = 1
I = 3
echo $A
echo $B
C = ‘expr $A + $B’
while [ $i -1e $n ]
do
echo $C
A = $B
B = $C
C = ‘expr $A + $B’
i = ‘expr $i + 1’
done

0 comments:

Post a Comment