apart from the long title (I used the better one used by toolic) and the poorly formatted text I suggest you to sign in order, in the future, to be able to edit your own post. For you personal colture PERL does not exists: Perl is the language name and perl is the program that executes your programs.
The, first, basic rule in programming is to translate a spoken problem or algorithm to a program.
> I must write a PERL program that randomly generates a number between 1 and 50 in groups of 5. Sum each group and display the results so that each number is on its own line.
The missing spec is: how many times you want to do this? let's say 3 time..
Let's see:
# a PERL program that.. use strict; use warnings; # the missing spec: 3 times for (1..3){ my $sum; # in groups of 5 for (1..5){ # randomly generates a number between 1 and 50 # Sum each group $sum += int (rand(50)+1); } # display the results so that each number is on its own line print "$sum\n"; }
L*
In reply to Re: Sum group of numbers and display each number is on its own line -- plain way
by Discipulus
in thread Dice roll chances
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |