Загрузка данных


using System;
class Program
{
    static void Main()
    {
        int col,row,A,B = 0;
        Console.Write("Введите кол-во столбцов:");
        col = Convert.ToInt32(Console.ReadLine());
        Console.Write("Введите кол-во строк:");
        row = Convert.ToInt32(Console.ReadLine());
        int[,] mas2D = new int[row, col];
        Console.Write("Введите диапозон рандома от:");
        A = Convert.ToInt32(Console.ReadLine());
        Console.Write("Введите диапозон рандома до:");
        B = Convert.ToInt32(Console.ReadLine());        
        Random rnd = new Random();
        for (int i = 0; i < col; i++)
        {
            for (int j = 0; j < row; j++)
            {
                mas2D[i,j] = rnd.Next(A,B);
                Console.Write($" {mas2D[i,j]} ||");
            }
            Console.WriteLine();
        }

        int[] mas1D = mas2D.Cast<int>().ToArray();
        Array.Sort(mas1D);
        for (int i = 0; i < row; i++)
        {
            for (int j = 0; j < col; j++)
            {
                mas2D[i, j] = mas1D[i * col + j];
            }
        }
        Console.WriteLine();
        for (int i = 0; i < col; i++)
        {
            for (int j = 0; j < row; j++)
            {
                
                Console.Write($" {mas2D[i,j]} ||");
            }
            Console.WriteLine();
        }

    }
}