Thursday, June 21, 2018

Write a shell script to find the largest among the 3 given numbers. - OS

echo "Enter first number: "
read a
echo "Enter second number: "
read b
echo "Enter third number: "
read c
if [ $a -ge $b -a $a -ge $c ]
then
echo "$a is largest integer"
elif [ $b -ge $a -a $b -ge $c ]
then
echo "$b is largest integer"
elif [ $c -ge $a -a $c -ge $b ]
then
echo "$c is largest integer"
fi

No comments:

Post a Comment