I’m working on a problem for a programming class that states the following:
Write a for loop in the space below which will add the numbers between 1 and 20.
To me this means the question is looking for the total sum of all the individual numbers from 1 up to 20 (1 + 2 + 3 + 4 + 5 + … + 20).
Is my understanding correct?
Are there any other ways to word this?
As a programmer, every usage of the between keyword I’ve seen would define ‘between X and Y’ as ‘greater than or equal to X and less than or equal to Y’
An example would be the BETWEEN comparison operator in MySQL.
I would say your interpretation of ‘between 1 and 20’ to include the upper and lower bounds (1 and 20) is absolutely correct.
Having said that, it could certainly be more clearly worded. For starters, adding ‘the numbers’ between 1 and 20, or even 1 and 1.000000001, would be an endless task. They should specify integers at the very least, as well as using a less ambiguous definition of the boundaries such as suggested by @MetaEd (+1).