Ex. No.: 2(b)(ii)
|
Shell Programs
Biggest among two numbers
|
AIM:
To write a
shell script program to find the biggest among given two numbers
ALGORITHM:
Step 1:
Start the program
Step 2:
Read the two numbers a and b
Step 3: If
‘a’ is greater than ‘b’ go to step4.
Step 4: If
‘b’ is greater than ‘a’ go to step5.
Step 5:
Print A is greater.
Step 6 :
Print B is greater.
Step 7 :
Stop the program
|
echo
"Enter the first number\n”
read a
echo "Enter the second
number\n "
read b
if [$a –gt $b]
echo “ $a is greater”
else
echo “$b is greater”
if
OUTPUT:
[csestaff@localhost csestaff]$
sh big.sh
Enter the first number
3
Enter the second number
5
5 is greater
RESULT:
Thus, the
shell script is written to find the biggest among given two numbers and its
output is verified.
No comments:
Post a Comment