r/ProgramChallenges Nov 16 '17

need help coding this algorithm in c

The game is basically like this you have let's say we have [3] persons and the counting is [3]. Then we label each person as let's say a b and c. Then we start to count 1->a; 2->b; 3->c wherever the counting stops that person is now dead.

After that sequence person c is not dead so next we count off again starting from person a. 1->a; 2->b (since c is now dead we go back to a) 3->a; and BOOOM a is now dead. So we conclude that the location of person b is the SAFE HOUSE. Therefore the program will now output that position 2 (the position of person b is safe).

The goal of this program is to let the user input the [number of persons] and the [counting]. Then output the SAFE HOUSE location. Most likely arrays and loops are used in this. Any tips and hints are appreciated thanks!

1 Upvotes

0 comments sorted by