Filling a matrix with values from the keyboard.
Let the program receive a two-dimensional array as input, in the form n em> strings, each containing m numbers separated by spaces. How to count them? For example, like this:
int[,] array = new int[n,m]; // create an array to populate
for (int i = 0; i < n; i++)
{
string A = Console.ReadLine(); // read line
int[] curr = A.Split(' ').Select(int.Parse).ToArray(); // convert this string to a one-dimensional array curr
for (int j = 0; j < m; j++)
{
array[i, j] = curr[j]; // fill in the string of the array we need with the values from the curr array
}
}