Algorithm
Step 1 : Start
Step 2 : Read values of a, b and c
Step 3 : If a > b and a > c then
Print "A is the biggest"
Step 3.1 : else if b > c then
Print "B is the biggest "
Step 3.2 : else
Print "C is the biggest"
Step 4 : Stop
Program (big3.sh)
# Biggest using logical expression
echo -n "Give value for A B and C: "
read a b c
if [ $a -gt $b -a $a -gt $c ]
then
echo "A is the Biggest number"
elif [ $b -gt $c ]
then
echo "B is the Biggest number"
else
echo "C is the Biggest number"
fi
Output
[vijai@localhost decision]$ sh big3.sh
Give value for A B and C: 4 3 4
C is the Biggest number
Step 1 : Start
Step 2 : Read values of a, b and c
Step 3 : If a > b and a > c then
Print "A is the biggest"
Step 3.1 : else if b > c then
Print "B is the biggest "
Step 3.2 : else
Print "C is the biggest"
Step 4 : Stop
Program (big3.sh)
# Biggest using logical expression
echo -n "Give value for A B and C: "
read a b c
if [ $a -gt $b -a $a -gt $c ]
then
echo "A is the Biggest number"
elif [ $b -gt $c ]
then
echo "B is the Biggest number"
else
echo "C is the Biggest number"
fi
Output
[vijai@localhost decision]$ sh big3.sh
Give value for A B and C: 4 3 4
C is the Biggest number
No comments:
Post a Comment