Four prospectors with only one lantern must walk through a mine shaft. At most, two prospectors can travel together and any prospector in the shaft must be with the lantern. The prospectors, named Andy, Brenda, Charlie and Dan, can walk through the shaft in one, two, four, and eight minute, respectively. When two walk together, they travel at the speed of the slower prospector. How can all four prospectors get through the mine shaft
Control structures
Control structures are block of statements that analyze the value of variables and determine the flow of execution based on those values. When a program is running, the CPU executes the code line by line. After sometime, the program reaches the point where it has to make a decision on whether it has to go to another part of the code or repeat execution of certain part of the code. These results affect the flow of the program's code and these are called control structures.
Switch Statement
The switch statement is a key feature that is used by the programmers a lot in the world of programming and coding, as well as in information technology in general. The switch statement is a selection control mechanism that allows the variable value to change the order of the individual statements in the software execution via search.
- Four prospectors with only one lantern must walk through a mine shaft. At most, two prospectors can travel together and any prospector in the shaft must be with the lantern. The prospectors, named Andy, Brenda, Charlie and Dan, can walk through the shaft in one, two, four, and eight minute, respectively. When two walk together, they travel at the speed of the slower prospector. How can all four prospectors get through the mine shaft in only 15 minutes? (On the first attempt, most get 16 minutes. There is a straight forward way to get 15.)
- The following is an addition problem in decimal notation. Each letter represents a different digit (0-9). What digit does each letter represent? How did you get your foot in the door?
A B C
+ B D B
C B C D
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 3 images