21 Matchstick Game: C Program
http://technotip.com/7264/21-matchsti...
Write a C program for a matchstick game being played between the computer and a user. Your program should ensure that the computer always wins. Rules for the game are as follows:
- There are 21 matchsticks.
- The computer asks the player to pick 1, 2, 3 or 4 matchsticks.
- After the person picks, the computer does its picking.
- Whoever is forced to pick up the last matchstick loses the game.
Note:
break; breaks out of the loop or terminates the execution of the loop.
continue; skips execution of all the code after it in the loop and goes for the next iteration of the loop.
C Programming Interview / Viva Q&A List
http://technotip.com/6378/c-programmi...
C Programming: Beginner To Advance To Expert
http://technotip.com/6086/c-programmi...
Write a C program for a matchstick game being played between the computer and a user. Your program should ensure that the computer always wins. Rules for the game are as follows:
- There are 21 matchsticks.
- The computer asks the player to pick 1, 2, 3 or 4 matchsticks.
- After the person picks, the computer does its picking.
- Whoever is forced to pick up the last matchstick loses the game.
Note:
break; breaks out of the loop or terminates the execution of the loop.
continue; skips execution of all the code after it in the loop and goes for the next iteration of the loop.
C Programming Interview / Viva Q&A List
http://technotip.com/6378/c-programmi...
C Programming: Beginner To Advance To Expert
http://technotip.com/6086/c-programmi...
همه توضیحات ...