-
Notifications
You must be signed in to change notification settings - Fork 0
/
if-elif-else-4.sh
62 lines (55 loc) · 1.17 KB
/
if-elif-else-4.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
#!/bin/bash
read -p "Enter first Number:" a
read -p "Enter second Number:" b
read -p "Enter third Number:" c
n1=$((($a+$b)*$c))
n2=$((($c+ $a/$b)))
n3=$(((($a%$b))/$c))
n4=$(((($a*$b)+$c)))
echo "$n1 $n2 $n3 $n4"
if((n1>n2)) ; then
if((n1>n3)); then
if((n1>n4)); then
echo "$n1 is a Greatest Number"
else
echo "$n4 is a Greatest Number"
fi
elif((n3>n4)); then
echo "$n3 is a Greatest Number"
else
echo "$n4 is a Greatest Number"
fi
elif((n2>n3)); then
if((n2>n4)); then
echo "$n2 is a Greatest Number"
else
echo "$n4 is a Greatest Number"
fi
elif((n3>n4)); then
echo "$n3 is a Greatest Number"
else
echo "$n4 is a Greatest Number"
fi
if((n1<n2)) ; then
if((n1<n3)); then
if((n1<n4)); then
echo "$n1 is a Smallest Number"
else
echo "$n4 is a Smallest Number"
fi
elif((n3<n4)); then
echo "$n3 is a Smallest Number"
else
echo "$n4 is a Smallest Number"
fi
elif((n2<n3)); then
if((n2<n4)); then
echo "$n2 is a Smallest Number"
else
echo "$n4 is a Smallest Number"
fi
elif((n3<n4)); then
echo "$n3 is a Smallest Number"
else
echo "$n4 is a Smallest Number"
fi