Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I have some question about computer programming. Can anyone make this for me?? T

ID: 3544694 • Letter: I

Question

I have some question about computer programming.

Can anyone make this for me??


There  are 100 doors (numbered 1 through 100) and 100 students labeled with  ids from 1 to 100 waiting in a line. Initially, all the doors are  closed. A student with and id x passes through all the doors that are  multiples of x(i.e., student with id x goes to doors labeled with x, 2x,  3x, ... ) and changes the status of each door, i.e., opens the door if  it is closed or closes the door if it is open. After all the students  complete their turns, which doors remain open? How do I write an  algorithm for this?

Explanation / Answer

int y[100];


for (int z=0; z++; z<101){

y[z] = 1;

}

for (int x=1; x++; x<101){

for(int m=1; m++; (m*x)<101){

if(y[mx] == 1){

y[mx] = 0;

}

else if(y[mx] == 0){

y[mx] = 1;

}

}

}

for (int z=0; z++; z<101){

printf("%d ", y[z]);

}

y is array of doors. y[0] to y[99] are 100 doors,

if value of y[] = 1 then door is closed, else door is open.