President gets advice from his pool of advisers every time he needs to make a decision. He has 13 top advisers that he really relies on. But if all of them are involved in any decision, they always end up in an argument where more often than not, the final decision is not achieved. To resolve this, a scheme was devised where only 5 of the 13 will be randomly chosen to decide on a certain matter.
They achieved this by having the 13 advisers arrange themselves in a circle. The President can start counting from a certain adviser with an appropriate counting interval. For example, he can start counting from adviser 1 with a counting interval of 4. Then the first adviser counter out will be adviser 4, followed by advisers 8, 12, 3 and 9. Note that those advisers who are already counted out will not be counted again.
Write a program that would ask which adviser to start from and ask the counting interval. Then, it should display which advisers were selected.
Input to the program will be 2 integers. The first integer is the starting adviser, which can range from 1 to 13. The second is the counting interval, which can range from 1 to 100. Repeat the program until the user enters 0 as the starting adviser.
Display the advisers which were selected in the order that they were selected each separated by a comma and a space.
: 9, 1, 6, 12, 5
: 1, 3, 6, 10, 4
You, and two friends, have been hired by a computer firm to clean up their office of all their unused diskettes. These are hidden in various desk drawers and must be collected together into a large pile. As a reward these diskettes are to be divided up equally between you and your friends to take home. How many diskettes were there to start with if the following is true? (There is more...
Please join StudyMode to read the full document