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.

Recommended Answers

You'll have to show your work and code then explain what's stopping you.
Read https://www.daniweb.com/programming/threads/435023/read-this-before-posting-a-question

Jump to Post

All 2 Replies

Pascal is a defunct language. Even the inventor of it redid it as Modula! If your school is still teaching Pascal, go somewhere else!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.