derpp has asked for the wisdom of the Perl Monks concerning the following question:
So, I'm stuck on a really dumb part of the program I'm working on. What I wanna do is for every number from 1 to 1000, i want to add and subtract alternately using a subroutine.
Ex. 1-2+3-4+5-6+7-8+9-10 and so on. Thanks for the help!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: stupid question about switching signs every number
by Marshall (Canon) on Aug 17, 2010 at 21:08 UTC | |
|
Re: stupid question about switching signs every number
by kennethk (Abbot) on Aug 17, 2010 at 21:16 UTC | |
by psini (Deacon) on Aug 20, 2010 at 20:27 UTC | |
|
Re: stupid question about switching signs every number
by jwkrahn (Abbot) on Aug 17, 2010 at 22:32 UTC | |
|
Re: stupid question about switching signs every number
by aquarium (Curate) on Aug 17, 2010 at 23:12 UTC | |
|
Re: stupid question about switching signs every number
by JavaFan (Canon) on Aug 17, 2010 at 22:03 UTC |