-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcalculator.sh
60 lines (56 loc) · 1.68 KB
/
calculator.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
echo " "
echo " ███████ ██ ██ ██████ ██ ██ █████ ███████ ██ ██ ██ ███████ "
echo " ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ "
echo " ███████ ██ ██ ██████ ███████ ███████ ███████ ███████ ██ ███████ "
echo " ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ "
echo " ███████ ██████ ██████ ██ ██ ██ ██ ███████ ██ ██ ██ ███████ "
echo " "
echo " THIS IS A CALCULATOR USE ME "
echo " "
echo -e "enter any two numbers :\c "
read x
echo -e "enter any 2nd numbers :\c "
read y
echo -e "select any operation bellow :\c"
echo "1 = sum"
echo "2 = diff"
echo "3 = product"
echo "4 = div"
echo "5 = All"
read z
while [ $z -ge 6 ]
do
echo "please enter a valid option : \c"
read z
done
if [ $z -eq 1 ];
then
((sum = $x + $y))
echo "Your Sum is :" $sum
fi
if [ $z -eq 2 ];
then
((diff = $x - $y))
echo "Your Difference is :" $diff
fi
if [ $z -eq 3 ];
then
((product = $x * $y))
echo "Your Product is :" $product
fi
if [ $z -eq 4 ];
then
((div = $x / $y))
echo "Your Division is :" $div
fi
if [ $z -eq 5 ];
then
((sum = $x + $y))
echo "Your Sum is :" $sum
((diff = $x - $y))
echo "Your Difference is :" $diff
((product = $x * $y))
echo "Your Product is :" $product
((div = $x / $y))
echo "Your Division is :" $div
fi