fidda has asked for the wisdom of the Perl Monks concerning the following question:
I'm trying out my HW, where I'm asked to practice nested for loops.
Req:
ID: 001 GRP:1 . . ID:020 GRP:20 ID:021 GRP:1 . . ID:120 GRP:20
but I did something wrong.
This is my looping -Please point out what am I doing wrong. TIAfor (my $i = 1; $i < 7; $i++) { for (my $g = 1; $g < 21; $g++) { my $j = $i * $g; my $id = sprintf ("%03d", $j); print "ID: $id\t GRP: $g \n"; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Need help with nested for loops
by davido (Cardinal) on Jan 07, 2015 at 20:07 UTC | |
|
Re: Need help with nested for loops
by blindluke (Hermit) on Jan 07, 2015 at 20:11 UTC | |
|
Re: Need help with nested for loops
by LanX (Saint) on Jan 07, 2015 at 20:02 UTC | |
|
Re: Need help with nested for loops
by GotToBTru (Prior) on Jan 07, 2015 at 20:02 UTC | |
|
Re: Need help with nested for loops
by Anonymous Monk on Jan 07, 2015 at 21:20 UTC |