LINUX SEHLL program for finding GREATEST OF THREE NUMBERS | Operating system LAB in LINUX | FIND the Biggest number

AIM:
To write a shell program for finding greatest among three numbers.
ALGORITHM:
• Get the three numbers to find the biggest number.
• Check if A is greater than B and C.
• if true print A as greater number if not b > c.
• if B > C print B is greater or C is greater.
• Terminate the program.

PROGRAM SOURCE CODE
echo ”enter 3 numbers”
read a
read b
read c
if [$a –eq $b –a $a –eq $c]
then
echo “3 number are equal”
elif [$a –gt $b –a $a –gt $c]
then
echo ”$a is the greatest number”
elif [$b –gt $c]
then
echo “$b is the greatest number”
else
echo “$c is the greatest number”
fi

CONCLUSION:
Thus the shell program to find the greatest among three values is written and executed successfully.

Post a Comment

0 Comments