≡ Menu

Fibonacci Series > Unix Shell Programming

You are Here: Home > Computer Subjects > Unix Shell Programming…

 

Fibonacci Series

Code:

clear

echo -n "Enter the Range==> "
read r

a=0
b=1
c=0

while test $a -le $r
do
	c=`expr $a + $b`

	echo $a

	a=$b
	b=$c
done

Output:

Enter the Range==> 10

0 1 1 2 3 5 8

 

Click Here to Find Latest Jobs and Current Affairs