Question
A high school has 1000 student and 1000 lockers,one locker for each student. On the first day of school, principal plays the following game: She asks the first student to go and open all the locker. She then asks the second student to go and close all the even-numbered locker. the third student is asked to chek every third locker. If it is open, the student closes it; if it is closed, the student opens it. the remaining students continue this game. in general , the nth student checks every nth locker. if the locker is open, the student close it; if it is closed, the student opens it.after all the students have taken their turn, some of the locker are open and some are closed. write a program that prompts the user to enter the no of lockers in a school .after the game is over, the program outputs the number of locker that are opened. test run your program for the following inputs: 1000,5000,10000. do you see any pattern developing?
Explanation / Answer
please rate - thanks #include int main() {int students; int locker[15000]; inti,j,open=0; coutstudents; for ( i=0; i