public static int targetX = 4;
public static int targetY = 5;
public static int pathFound = 0;
public static void Main(string[] args)
int[,] input = new int[5, 6]
GetPosiblePaths(input, 0, 0);
Console.WriteLine(pathFound);
static void GetPosiblePaths(int[,] input, int xIndex, int yIndex)
if (xIndex == targetX && yIndex == targetY)
int xDimentionLength = input.GetLength(0);
int yDimentionLength = input.GetLength(1);
if (xIndex < xDimentionLength - 1)
if (input[xIndex + 1, yIndex] == 0)
GetPosiblePaths(input, xIndex + 1, yIndex);
if (yIndex < yDimentionLength - 1)
if (input[xIndex, yIndex + 1] == 0)
GetPosiblePaths(input, xIndex, yIndex + 1);