Simple calculator in unix shell script


echo "enter the value of a"

read a

echo "enter the value of b"

read b

echo "enter 1 for addition"

echo "enter 2 for subtraction"

echo "enter 3 for multiply"

echo "enter 4 for divison"

read c

case $c in

1)

sum= expr $a + $b

echo $sum

;;

2)

sum= expr $a - $b

echo $sum

;;

3)

sum= expr $a \* $b

echo $sum

;;

4)

sum= expr $a / $b

;;

esac

Post a Comment

If you have any doubts, Please let me know
Thanks!

Previous Post Next Post