A shell-script to find the maximum and minimum from 10 number.

echo¬† “Enter the number:”

min=9999

max=0

for((i=1;i<=10;i++))

do

read n

if [ $n -gt $max ]

then

max=$n

fi

if [ $n -lt $min ]

then

min=$n

fi

done

echo max:$max

echo min:$min

 

OUTPUT::

 

Enter the number:

85

25

36

14

25

65

85

96

25

45

max:96

min:14

 

 

Share

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.