using System;
class MainClass {
public static void Main (string[] args) {
Console.WriteLine ("This is a multidimensional array with two dimension D1 and D2!");
int D1 = 5;
int D2 = 3;
// two dimensional array
int[,] array_ex_001 = new int[D1, D2];
array_ex_001[1, 2] = 76;
Console.WriteLine("array at 0,0 is " + array_ex_001[0,0]);
Console.WriteLine("array at 1,2 is " + array_ex_001[1,2]);
// two dimensional array
int[,] array_ex_002 = {{1,2},{3,4}};
for (int i = 0; i < array_ex_002.GetLength(0); i++)
{
for (int j = 0; j < array_ex_002.GetLength(1); j++)
{
Console.WriteLine (array_ex_002[i,j]);
}
}
// three dimensional array with sized 4,2,3
int[,,] array_ex_003 = new int[4, 2, 3];
array_ex_003[2, 1, 1] = 76;
// use for to show values , default is 0
for (int a = 0; a < array_ex_003.GetLength(2); a++)
{
for (int b = 0; b < array_ex_003.GetLength(1); b++)
{
for (int c = 0; c < array_ex_003.GetLength(0); c++)
{
Console.Write(array_ex_003[c, b, a]);
}
Console.WriteLine();
}
Console.WriteLine();
}
}
}