I'm having difficulty with arrays. It's probably an easy thing to understand but I haven't had much time lately to look into it fully.

My program that I'm trying to make involves arrays but not that much. I'm just having trouble figuring out the loops.

Here is the assignment:
Suppose that a row of closed mailboxes are numbered 1 through 150 and that beginning with mailbox 2, we open the doors of all the even-numbered mailboxes. Next, beginning with mailbox 3, we go to every third mailbox, opening its door if it is closed and closing it if it is open. We repeat this procedure with every fourth mailbox, then every fifth mailbox, and so on. Write a program to determine which mailboxes will be closed when this procedure is completed.


I know there are a good amount of loops. I have to have a for loop within another for loop. But the other loops I'm having trouble figuring out.

He showed us on the board in class some stuff that should be in the program to help us out but yet I'm still having some trouble.

Code:
bool mailbox; [151]
mailbox = false;
mailbox = true;
mailbox != mailbox

for (j=2; j <=150; j++)
for (i = j; j <= 150; i +=j)
I probably copied some of this wrong. But those should be about what the for loop within another for loop should look like. Pretty much I'm confused about this in general. If anyone could help me in the right direction, that would be great.