21 Stick Game 
If there are 21 sticks and two players - user & computer.
Rules for the game are as follows:
- There are 21 matchsticks.
- First turn is of user and computer asks the player to pick 1, 2, 3 or 4 matchsticks.
- After the person picks, the computer does its picking. Computer will pick up maximum 4 sticks.
- Turns will be one by one.
- Now who ever picks up the last key will lose the game and we have to make sure in our program that Computer must win.
Logic Implemented
The computer asks the player to pick 1, 2, 3 or 4 matchsticks.
So if we reduce the total by 5 each round, the sequence will go
21 16 11 6 1
In effect, whatever number the user picks (n), the computer picks 5-n
Program for 21 stick game
using System;
namespace _21stick_game
{
class Program
{
static void Main(string[] args)
{
int stick = 21, user, computer;
while (stick > 0)
{
Console.WriteLine("There are {0} Sticks Choose Either 1,2,3 or 4 stick", stick);

Jeetendra GundPosted Sep 6, 2013, 12:21 AM
Enter in this sequence 1 2 3 4 and last 0 you win, because priyanka not check condition for zero. when u not enter 0 then always u loss.
Vithal WadjePosted Aug 29, 2013, 2:47 PM
woh...i loss the game but good programming keep it up in future also