Code:
#include <stdio.h>
int main ()
{
int rows[] = { 2, 4, 6}; //Printing Game board
int i, j; // Variable in Printing Gameboard
int player =1; //The players
int rowChosen, sticksChosen; //Scan purpose
int sum;
printf("\n\n\tWELCOME TO GAME OF NIM\t\n\n");
for(i = 0; i < 3; i++)
{
printf("\nRow %d:", i+1);
for(j = 0; j < rows[i] ; j++)
{
printf("\t|");
}
printf("\t|");
}
printf("\n");
printf("Please Enter a Row: ");
scanf("%d", rowChosen);
printf("Please Enter how many stick you will get: ");
scanf("$d", sticksChosen);
rows[rowChosen+1] -= sticksChosen;
sum -= sticksChosen;
return 0;
}
It runs now but when i enter a row number the program will be shut down..