How should I modify this for loop to satisfy a condition?

So let’s say that we have a for loop:

SIZE = 3; // can be changed later on

for (int a = 250; a < SIZE; a += 100)

What number should I add/multiply to SIZE so that the loop only runs 3 times? And I can’t set SIZE to a fixed number because it can change later on.


Start here to understand for loops:

Write a few lines of code and try it.

1 Like