Commit c30fdd06 authored by mohamadbashar.disoki's avatar mohamadbashar.disoki

Merge branch 'shouib.sobh/linux-scripts-add-your-script'

parents b4bc0134 84b3700d
# Simple calculator to calculate tow number
simple calculator to calculate tow number the calculator show 5 choice after you enter the numbers
1. Addition
2. Substraction
3. Multiplication
4. Division
5. to exit
#!/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