Here's the question: A new school has 1000 students, and 1000 closed lockers numbered 1 to 1000 The first student opens all the 1000 lockers. The second student closed all lockers with numbers that are multiples of 2. The third student 'reverses' all lockers with numbers that are multiples of 3 - he closes the locker if it is open, and opens the locker if it is closed. The forth student reverse all lockers with numbers that are multiples of 4, and so forth until all the 1000 students reverse the relevant lockers. Which lockers will be left open in the end?
My homework Look inside for the code.