Monday, May 17, 2010

Bash shell programming Find Fibonacci Series in Linux and UNIX Programming

Bash shell –lt refers to less than –le indicate less than or equal to using simple mathematical algorithm it will perform the mathematical calculation and display Fibonacci series using Linux and UNIX shell programming . it use echo command to display the result.
Source code bash shell Programming Algorithm
echo "Enter the number"
read n
i=1
a=-1
fib=0
b=1
echo "Fibonacci series is"
while [ $i -lt $n ]
do
fib=`expr $a + $b`
a=$b
b=$fib
echo $fib
i=`expr $i + 1`
done
OUTPUT Find FIBONACCI SERIES CS1252 Operating Systems lap
[redhat35@localhost Rhel5]$ sh fib.sh
Enter the number
8
Fibonacci series is
0
1
1
2
3
5
8

3 comments:

Anonymous said...

thanx........

Anonymous said...

check this out http://dileepmani19.blogspot.in/2012/04/fibonacci-numbers.html

Anonymous said...

check this out http://dileepmani19.blogspot.in/2012/04/fibonacci-numbers.html

Flag counter

free counters