/* A high school has a new principal. On /* his first day he had his students /* perform an opening day ceremony. /* There are 1000 lockers and 1000 /* students in the school. The principal /* asks the first student to go to every /* locker and open it. Then he asks the /* second student to go to every second /* locker (even #) and close it. He has /* the third student go to every third /* locker and open it if it's closed and /* close it if it's open. He has the fourth /* student do this to every fourth locker /* and so on. After the process is completed /* with the 1000th student how many lockers /* are open? alanna [ int la(1000),i,ln,tot /* locker array, index, locker number, total pl "alanna2.tc - tct - 9/30/2016";pl "";pl "" for (ln=1;ln<=1000;++ln) [ for (i=ln;i<=1000;i=i+ln) [ la(i)=1-la(i) /* toggle locker state ]] for (i=1;i<=1000;++i) [ if (la(i)==1) [ /* if open, display and tally pn i;++tot if (i%10==0) pl "" ]] pl "";pl "";pn tot;ps " lockers are open.";pl "" ]