W.A.S.S to find the maximum of three numbers
Program
# W.A.S.S to find the maximum of three numbers
echo "Enter three No.:"
read no1
read no2
read no3
if test $no1 -gt $no2 # -gt is stands for greater than
then
if test $no1 -gt $no3 # Return a status of 0 (True) or 1 (False) depending on the
# evaluation of the conditional expression exp
then
echo "$no1 is Max of three nos."
else
echo "$no3 is Max of three nos."
fi # fi is the end of if..else block
else
if test $no2 -gt $no3
then
echo "$no2 is Max of three nos."
else
echo "$no3 is Max of three nos."
fi
fi
Output
Enter three No.:
10
15
12
15 is Max of three nos.