Problems with the avarage loop

I'm curious as to what this "i" is

if (i % 10 == 0 && i != 0) {

Reason I'm asking is that it appears (to me, anyway) that you re-declare it as an int in the very next line.

You also have && i != 0. But one of the last lines sets i=0. So, if it's being set to 0 at the end, then !=0 is not possible. I'm no guru, so maybe there's more to it than what I'm seeing. Or think I'm seeing.