But you've missed an important advantage of having a loop control variable. Consider this:

sum += onetoTen[i];

Also, your indentation is inconsistent. It should look like this (open brace on...