Saturday, May 07, 2011

Fibbonacci(LINUX)

#!/bin/sh
echo "Enter the Number :"
read a
echo "Enter Second Number :"
read b
i=1
echo "enter The Number of Terms :"
read n
echo "Fibonacci Series of The Entered Number is "
echo $a
echo $b
while [ $i -le $( expr $n - 2 ) ]
do
c=$( expr $a + $b )
i=$( expr $i + 1 )
echo $c
a=$b
b=$c
done
exit 0

No comments:

Post a Comment