i wanna fill a matrix in C# with user's inputs,but i have trouble with it.when i enter rows and cols equal with each other,it work; but when i enter rows and cols different with each other the program stop . the code is
int row = 0;
int col = 0;
int[,] matrix1;
row = Convert.ToInt16(Console.ReadLine());
col = Convert.ToInt16(Console.ReadLine());
matrix1=new int[row,col];
Console.WriteLine("enter the numbers");
for (int i = 0; i < row; i++)
{
for (int j = 0; j < col; j++)
{
matrix1[i, j] = Convert.ToInt16(Console.ReadLine());// i have problem with this line,... plz show me the correct form
}
}