I think you need to add a for loop and how many times does it need to loop, what's the purpose of the code?

Try putting the if/else statement between this:

for (int i=?; i<? ;i++)
{
}
...