public static void Main()
Console.WriteLine("Hello World");
static int[][] myMatrix ;
static int numberOfRows = 0;
static int numberOfColumns = 0;
public static void StartMe()
Console.WriteLine ("---- START ----/n");
Console.Write ("Enter number of rows: ");
Int32.TryParse (Console.ReadLine (), out numberOfRows);
Console.Write ("Enter number of columns: ");
Int32.TryParse (Console.ReadLine (), out numberOfColumns);
Console.Write ("\nEnter value to search for: ");
Int32.TryParse (Console.ReadLine (), out searchVal);
Console.Write ("\nSearch for another or press 'x' to exit:: ");
cont = Console.ReadKey ().Key != ConsoleKey.X;
private static void Init()
if (numberOfRows > 0 && numberOfColumns > 0) {
myMatrix = new int[numberOfRows][];
for (int row = 0; row < numberOfRows; row++) {
int[] tempArray = new int[numberOfColumns];
for (int col = 0; col < numberOfColumns; col++) {
Console.Write (String.Format (" Enter value for [{0}], [{1}] :", row+1, col+1));
Int32.TryParse (Console.ReadLine (), out read);
myMatrix [row] = tempArray;
Console.WriteLine ("array dimensions are not set!");
Console.WriteLine ("Your matrix is initialized as: ");
for (int row = 0; row < numberOfRows; row++)
for (int col = 0; col < numberOfColumns; col++) {
Console.Write (String.Format ("[{0}]\t", myMatrix [row] [col]));
Console.WriteLine ("\n");
private static void Search(int searchValue)
if (myMatrix != null && myMatrix.Length > 0) {
for (int row = 0; row < numberOfRows; row++) {
for (int col = 0; col < numberOfColumns; col++) {
if (myMatrix [row] [col] == searchValue) {
Console.WriteLine (String.Format ("Item found at [{0}][{1}] with {2} look-ups", row+1, col+1, lookUpCount));
Console.WriteLine ("array is empty, please initialize it first!");
Console.WriteLine ("Item not found!");
public static void EndMe()