Hey,
I was practicing some c# concepts while i found this weird thing happening. I am basically creating a simple two dimensional array with 3 rows and 2 columns. Here is the code.
using System;
class Array
{
public static void Main()
{
int[,] myArray =
{
{ 2, 3 },
{ 4, 5 },
{ 6, 7 }
};
int x;
int y;
for (x = 0; x < 3; x++)
for (y = 0; y < 2; y++)
Console.WriteLine( myArray[x, y] + " ");
Console.WriteLine();
}
}
Everything seems fine, and once I debug it, there are no build errors. However, when the console results are shown the follwing is displayed:
2
3
4
5
6
7
It do not want this type of display. My preference is:
2,3
4,5
6,7
Can anyone show what im doing wrong. Please and thanks!!
I was practicing some c# concepts while i found this weird thing happening. I am basically creating a simple two dimensional array with 3 rows and 2 columns. Here is the code.
using System;
class Array
{
public static void Main()
{
int[,] myArray =
{
{ 2, 3 },
{ 4, 5 },
{ 6, 7 }
};
int x;
int y;
for (x = 0; x < 3; x++)
for (y = 0; y < 2; y++)
Console.WriteLine( myArray[x, y] + " ");
Console.WriteLine();
}
}
Everything seems fine, and once I debug it, there are no build errors. However, when the console results are shown the follwing is displayed:
2
3
4
5
6
7
It do not want this type of display. My preference is:
2,3
4,5
6,7
Can anyone show what im doing wrong. Please and thanks!!