| | |
problem of rhyme game
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Sep 2007
Posts: 24
Reputation:
Solved Threads: 1
i want to solve thi assignment ....so if any one can help me with it i 'll really appreciate it.
Your group decided to play a game called rhyme. The game is simple; all of your friends must be in a circle and say the rhyme in clockwise turn. The person who says the last rhyme will be eliminated. Then start all over again at the next turn until one person is left.
For example, 6 friends with 4 words rhyme “eenie, meenie, mainee, mo”:
The first person leave is number 4, followed by 2 then 1, 3 and 6. Number 5 is left.
Your task is to write a program that input two numbers (between 1 and 100), the first being n, the number of friends and the second is the number of words in rhyme. The output should be the number of the last person left.
Your group decided to play a game called rhyme. The game is simple; all of your friends must be in a circle and say the rhyme in clockwise turn. The person who says the last rhyme will be eliminated. Then start all over again at the next turn until one person is left.
For example, 6 friends with 4 words rhyme “eenie, meenie, mainee, mo”:
The first person leave is number 4, followed by 2 then 1, 3 and 6. Number 5 is left.
Your task is to write a program that input two numbers (between 1 and 100), the first being n, the number of friends and the second is the number of words in rhyme. The output should be the number of the last person left.
•
•
Join Date: Jan 2008
Posts: 57
Reputation:
Solved Threads: 5
Well, if you're waiting for someone to do your homework for you... you'll probably keep waiting.
Here's a hint, though. Use a loop that will continue to execute until you get to the last person.
Find a data structure than can hold the 'n' number of friends, iterate through one person each time the loop goes around, and every x times (the # of words), remove someone from your data structure.
- Walkere
Here's a hint, though. Use a loop that will continue to execute until you get to the last person.
Find a data structure than can hold the 'n' number of friends, iterate through one person each time the loop goes around, and every x times (the # of words), remove someone from your data structure.
- Walkere
![]() |
Similar Threads
Other Threads in the PHP Forum
- Previous Thread: Populating Multiple Text Fields Based On A Dynamic Drop-Down List Selection
- Next Thread: search date
| Thread Tools | Search this Thread |
.htaccess ajax apache api array beginner binary body broken cakephp checkbox class cms code cron curl database date date/time display dynamic echo email error file files folder form forms function functions global google href htaccess html image include insert integration ip java javascript joomla limit link list login loop mail memmory menu mlm mod_rewrite msqli_multi_query multiple mycodeisbad mysql navigation oop parameter paypal pdf php problem query radio random recourse recursion regex registrationform remote script search seo server sessions sms soap source space sql static syntax system table tutorial update upload url validation validator variable video web webdesign wordpress xml youtube





