You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
966 B
C#

using System;
public class Exercise14
{
public static void Main()
{
int i,j;
int[,] arr1 = new int[3,3];
Console.Write("\n\nRead a 2D array of size 3x3 and print the matrix :\n");
Console.Write("------------------------------------------------------\n");
/* Stored values into the array*/
Console.Write("Input elements in the matrix :\n");
for(i=0; i<3; i++)
{
for(j=0; j<3; j++)
{
Console.Write("element - [{0},{1}] : ",i,j);
arr1[i,j] = Convert.ToInt32(Console.ReadLine());
}
}
Console.Write("\nThe matrix is : \n");
for(i=0; i<3; i++)
{
Console.Write("\n");
for(j=0; j<3; j++)
Console.Write("{0}\t",arr1[i,j]);
}
Console.Write("\n\n");
}
}