There are two division options: one returns the quotient and the other returns reminder.
The script requires 3 arguments: The operation to be used and two integer numbers.The options are add(-a), subtract(-s), multiply(-m), quotient(-c) and reminder(-r).
echo "Enter First Value "
read x
echo "Enter Second Value "
read y
while [$q –ne 0 ]
do
echo “Enter –a for adding”
echo “Enter –s for subtraction”
echo “Enter –m for multiplication”
echo “Enter –c for Quotient”
echo “Enter –r for reminder”
read s
case $s in
-a) p=`expr $x + $y`
Echo "Sum = $p"
;;
-b) p=`expr $x - $y`
Echo "difference = $p"
;;
-m) p=`expr $x \* $y`
Echo "Product = $p"
;;
-c) p=`expr $x / $y`
Echo "quotient = $p"
;;
-r) p=`expr $x % $y`
Echo “reminder = $p"
;;
If you like this please Link Back to this article...
0 comments:
Post a Comment