Two Dimensional Array In C Sharp


using System;
class TwoDimensionalArray
{
static void Main()
{
int[,] arr1 = new int[2,3];

int rows = arr1.GetLength(0);
int cols = arr1.GetLength(1);

for(int i=0;i<rows;i++)
{
for(int j=0;j<cols;j++)
{
Console.Write("Enter the value at arr1[{0},{1}] \t ", i,j);
arr1[i,j] = Convert.ToInt32(Console.ReadLine());
}
Console.WriteLine();
}
for(int i=0;i<rows;i++)
{
for(int j=0;j<cols;j++)
{
Console.Write(arr1[i,j] + "\t");
}
Console.WriteLine();
}
        }
}
----------------------------------------------------------------------------------------------------------


Two Dimensional Array In C Sharp Two Dimensional Array In C Sharp Reviewed by Baljeet Singh on 22:47 Rating: 5

No comments:

Powered by Blogger.