-
Notifications
You must be signed in to change notification settings - Fork 0
/
infiniteswcase.sh
42 lines (42 loc) · 1017 Bytes
/
infiniteswcase.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/bash
count=0
echo "Welcome to Arithmetic calculator"
echo "Choose the below options \n 1.Addition \n 2.Subtraction \n 3.Multiplication \n 4.Division \n 5.back to Menu"
read num
while [ $count -eq 0 ]
do
case $num in
1) echo " You have selected addition"
echo "Please enter 2 values"
read a
read b
sum=`expr $a + $b`
echo "the sum of $a and $b is $sum"
;;
2) echo "Please enter 2 values"
read a
read b
difference=`expr $a - $b`
echo "the difference of $a and $b is $difference"
;;
3) echo " You have selected multiplication"
echo "Please enter 2 values"
read a
read b
product=`expr $a \* $b`
echo "the product of $a and $b is $product"
;;
4) echo " You have selected division"
echo "Please enter 2 values"
read a
read b
quotient=`expr $a / $b`
rem=`expr $a % $b`
echo "the division of $a and $b gives quotient $quotient and remainder $rem"
;;
5) count=1
;;
*) echo "You have not entered the valid option"
;;
esac
done