#### sumall:  Sum many numbers

total=0
count=0

echo "#### Sum many positive numbers. ####"
echo -n "How many numbers?	"
read many

while [ $count -lt $many ]
do

	let count=count+1
	echo -n "Next number:	"
	read n
	while [ $n -eq 0 ]
	do
		echo "Zero is not allowed!"
		echo -n "Try again!"
		read n
	done
	# (Nested loop.)

	let total=$total+$n
	echo "($total)"
done

echo "The grand total is:	$total"
let avg=$total/$count
let product=$avg*$count
let rem=$total-$product

fraction=""
if [ $rem -gt 0 ]
then
	fraction=" + $rem/$total"
fi
echo "The mean average is:     $avg $fraction"

echo "# Thank you for using my sumall script. #"
exit 0
