Karanbir S.
asked 04/22/21
Declare and initialize a 3 by 2 array that contains integer values. You decide what the values are.
- Declare and initialize a 3 by 2 array that contains integer values. You decide what the values are.
Inactive Tutor
answered 04/22/21
using System;
class Array2D
{
static void Main()
{
int[,] arr2d = new int[3,2]
{
{1, 2},
{3, 4},
{5, 6}
};
for (int rowLoop=0; rowLoop<3; rowLoop++)
{
for (int columnLoop=0; columnLoop<2; columnLoop++)
{
Console.Write(arr2d[rowLoop,columnLoop] + " ");
}
Console.WriteLine(" ");
}
}
}
Still looking for help? Get the right answer, fast.
OR
Find an Online Tutor Now
Choose an expert and meet online.
No packages or subscriptions, pay only for the time you need.