A jail has 100 cells, numbered 1 to 100. The king Declares some sort of amnesty and orders the following. step 1: make sure all Cells are closed step2: reverse (if open, close; if close, open) those Cells whose numbers are divisible by 1 (in this step, all cells will be Opened); step 3: reverse those that are divisible by 2 (in this step, All even numbered cells will be closed); step 4: reverse those that are Divisible by 3; step 5: reverse those divisible by 4; step 6 to step 101: and so on . . . step 102: release the prisoners in those cells which are finally Open. How many prisoners will be released, and from which cells?
This question is related to Infosys Interview
-
Interview Candidate
- Sep 1st, 2005
- 12
- 6467
Showing Answers 1 - 12 of 12 Answers
Related Answered Questions
Related Open Questions
A jail has 100 cells, numbered 1 to 100. The king Declares some sort of amnesty and orders the following. step 1: make sure all Cells are closed step2: reverse (if open, close; if close, open) those Cells whose numbers are divisible by 1 (in this step, all cells will be Opened); step 3: reverse those that are divisible by 2 (in this step, All even numbered cells will be closed); step 4: reverse those that are Divisible by 3; step 5: reverse those divisible by 4; step 6 to step 101: and so on . . . step 102: release the prisoners in those cells which are finally Open. How many prisoners will be released, and from which cells?
Related Answered Questions
Related Open Questions