Thursday, May 1, 2008

Write a shell script to do all arithmetic operations using case statement.

echo “Enter two number”

read a b

echo “1.Add 2.Sub 3.Mul 4.Div 5.Exit”

read op

case $op in

1) expr ‘$c=$a+$b’ ;;

2) expr ‘$c=$a-$b’ ;;

3) expr ‘$c=$a\*$b’ ;;

4) expr ‘$c=$a/$b’ ;;

5) exit

esac

echo $c

3 comments:

Anonymous said...

doesnt giving the output

Unknown said...

Please I need the output of this program

Unknown said...

Please i need the output of this program