Commit d86e5d7a authored by shouib.sobh's avatar shouib.sobh

simple calculator to calculate tow number

parent b4bc0134
#!/bin/bash
# this is a calculatre to calculate two numbers
echo "Enter two numbers: "
read a
read b
echo "Enter your choice: "
echo "1. Addition"
echo "2. Substraction"
echo "3. Multiplication"
echo "4. Division"
echo "5. to exit"
read c
while [ $c != 5 ]
do
if [ $c -eq 1 ]
then
res=$(( $a + $b))
fi
if [ $c -eq 2 ]
then
res=$(( $a - $b))
fi
if [ $c -eq 3 ]
then
res=$(( $a * $b))
fi
if [ $c -eq 4 ]
then
res=$(( $a / $b))
fi
echo "Result: $res"
echo "Enter two numbers: "
read a
read b
echo "Enter your choice: "
echo "1. Addition"
echo "2. Substraction"
echo "3. Multiplication"
echo "4. Division"
echo "5. to exit"
read c
done
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment