There's 40 soldiers in a line, and you walk down the line, and kill every 10th soldier. How would you write a program to figure out which soldier is the last standing? Me and my friend have been making theories but can't really figure anything out.
Start at the beginning. Move along the array, adding the numbers. When you get to ten, set that element to zero, set your count back to zero, and keep going. When you get to the end of the array, loop round to the start.
This is, you will note, essentially exactly what you would do in real life. THis is extraordinarily easy to model.