in reply to
Average/mean calculator

Hi, store your numbers in an array or update the sum and count as you go, then you only need to divide by the count. Something like this:

`print "In this version you can use up to TEN NUMBERS! \n";
print "when you have entered the numbers you need type 'end' \n";
my $count = 1;
my $total = 0;
while ($count <= 10) {
print "Enter number $count ";
my $num = <STDIN>;
chomp $num;
last if $num eq "end";
$total += $num;
$count++;
}
print " Average is: ", $total / $count, "\n";
`