Your last question is: given integers $a,\,b$ with $a\leq b$, how many integers $i$ are there with $a\leq i\leq b$?

Take a specific example; $a=1,\,b=4$. The integers $i$ are $\{1,2,3,4\}\text{ or } 4\text{ possibilities}$, that is $b-a+1$.

A related loop:

Code:

i=a;
while (i<b) {
// stuff
i=i+1;
}

The above loop executes $b-a$ times! The difference is usage of $<$ instead of $\leq$. If you really want to do it, this can be proved by inducting on $n=a-b$. I think this is overkill. You should be able to believe it by examining small examples.