Saturday, 16 March 2013

CPL 6a Xperiment for OBS


Exp.No.6a ARITHMETIC OPERATIONS USING CASE - ESAC



Coding

echo "Menu"
echo "1.Addition" echo "2.Subtraction" echo "3.Multiplication" echo "4.Division"
echo  -n "Enter your choice" read ch
echo  -n "Enter the values for a and b:"
read a b
case  $ch  in
c=`expr $a  + $b`
echo "The sum is $c";;
2) c=`expr $a  - $b`
echo "The difference is $c";;
3) c=`expr $a \* $b`
echo "The product is $c";;
4)  c=`expr $a / $b`
echo "The quotient is $c";;
*) echo "Enter the correct choice";;
esac

No comments:

Post a Comment