Write a Shell Script to find the Fibonacci series of any number
Solution:
echo Enter any number
read a
x=0
y=1
z=0
echo Fibonacci Series upto $a will be:
echo $x
echo $y
while [ $a -ge $z ]
do
z=`expr $x + $y`
if test $z -ge $a
then
exit
fi
echo $z
x=`expr $y`
y=`expr $z`
done
Execution:
No comments:
Post a Comment