in reply to Re^3: Averages in bowling
in thread Averages in bowling
{my @score; my @ave; my @han; my $i=0; my $j=0; my $k=0; my $l=0; my $o=0; my $teamhand;} print "How many bowlers are there?\n"; chomp(my $n=<>); $n-=1; print "\nHow many games did the bowlers play?\n"; chomp(my $m=<>); $m- +=1; for $i(0..$n){ for $j(0..$m){ $l=$i+1; $o=$j+1; print "\nPlease enter bowler $l s score for game $o: "; chomp($score[$i][$j]=<>); } } for $i(0..$n){ undef $k; for $j(0..$m){ $k+=$score[$i][$j]; } push @ave, int($k/($m)); } for $k(0..$n){ if($ave[$k]<=200){ $han[$k]=int((200-$ave[$k])*(.85)); } if($ave[$k]>=200){ $han[$k]=0; } } for $i(0..$n){$teamhand+=$han[$i];} for $i(0..$n){ $j=$i+1; print "\nBowler $j s Average: $ave[$i] Bowler $j s Handicap: $han +[$i]\n"; } print "\nThe team's handicap is: $teamhand\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Averages in bowling
by ikegami (Patriarch) on Mar 21, 2006 at 22:20 UTC | |
by Andrew_Levenson (Hermit) on Mar 21, 2006 at 23:36 UTC |