October 7th, 2011, 02:03 AM
The sweet program
im new to programming!
n children numbered 1 to n are sitting in a circle. starting at child 1, a sweet is passed. after m passes the child holding the sweet is eliminated. if child x gets eliminated he gives the sweet to child x+1 and leaves the ring. that does not count far a pass. the children in the circle close ranks and the game continues with the child who was sitting after the eliminated child,taking the sweet. assume m is constant for each elimination.
write a program that will determine which child would get the sweet in the end.
I'm totally confused please help!!!!!!
How would i go about solving such a problem?
Tags for this Thread
Click Here to Expand Forum to Full Width
This is a Codeguru.com survey!