A FOR
loop would be useful.
A FOR
loop can be used because the starting and ending values are
known in advance.
But what starting and ending values?
Two things are being counted upward: the number of gross (counting up by one's)
and the number of items (counting up by 144's).
The table looks like this:
Number of Gross Number of Items 1 144 2 288 3 432 . . . 10 1440
You might be tempted to use a FOR
loop that looks like this:
FOR ITEMS = 144 TO 1440 STEP 144 . . . NEXT ITEMS
This looks reasonable, since the number of items steps up by 144 each time. But the number of gross goes up by one each time. When you have a choice, almost always it is a good idea to count upward by ones. Here is a version of the program that does that:
PRINT "Number of Gross", "Number of Items" FOR GROSS = 1 TO 10 PRINT GROSS, GROSS * 144 NEXT GROSS END
Loops that count upward by ones are easier to understand than loops that count in other patterns. Always use an upward-by-one counting loop if you can.
There are 500 sheets in a ream of copier paper. Write a program that prints a table giving the number of reams and the number of sheets. Go up to 10 reams.