Thursday, 11 December 2014

Shell Script to find the Largest of three numbers

Write a Shell Script to find the Largest of three numbers

Solution:

echo Enter the Three numbers
read a b c
if test $a -gt $b
then
if test $a -gt $c
then
echo $a is greatest
else
echo $c is greatest
fi
elif test $b -gt $c
then
echo $b  is greatest
else
echo $c is greatest
fi

Execution:

No comments:

Post a Comment