using System; class Program { static void Main() { int n = 5, m = 12, imin = 0, imax = 0, max = 0, min = 100; var a = new Int32[n, m]; var random = new Random(); for (var i = 0; i < n; i++, Console.WriteLine()) for (var j = 0; j < m; j++) { a[i, j] = random.Next(100); if (max < a[i, j]) { max = a[i, j]; imax = j; } if (min > a[i, j]) { min = a[i, j]; imin = j; } Console.Write("{0,4}", a[i, j]); } if (imin == imax) Console.WriteLine("Элементы находятся в одном столбце"); else { Console.WriteLine(); for (int i = 0; i < n - 1; i++) for (int j = i + 1; j < n; j++) if (a[i, imin] > a[j, imin]) { var temp = a[i, imin]; a[i, imin] = a[j, imin]; a[j, imin] = temp; } for (int i = 0; i < n - 1; i++) for (int j = i + 1; j < n; j++) if (a[i, imax] < a[j, imax]) { var temp = a[i, imax]; a[i, imax] = a[j, imax]; a[j, imax] = temp; } for (var i = 0; i < n; i++, Console.WriteLine()) for (var j = 0; j < m; j++) Console.Write("{0,4}", a[i, j]); } Console.Read(); }}Пример: