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.
Sarah_23 0 Newbie Poster
rproffitt 2,662 "Nothing to see here." Moderator
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.