04.04.2017, 15:20
You're increasing i twice per iteration; once before the loop body and once after it. This means it'll skip every other item. So the only items that get checked are 1, 3, 5, 7, etc. Remove the ++ in the condition. And it should probably be < instead of <= as well.