A children's game of 'count out' is played as followed. '40' children are arranged in a circle, a sentence containing of 'm' words is used to eliminate '1' child at a time until '1' child is left. Starting at child '1' the children are counted from '1' to 'm' and the 'm' th child is eliminates. Starting with the child after the one just eliminated the children are then counted from '1' to 'm' and the 'm'th child is eliminated. This is repeated until one child is left. Counting is done circularly and eliminated children are not counted. Write a program to read a value for m and print the number of the last remaining child.
Jump to Post
You'll have to show your work and code then explain what's stopping you.
All 2 Replies
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.