It is necessary to swap the columns k1 and k2
I don’t even succeed in changing only one column and all ((-Teams such Data are two numbers k1 and k2 and a 4 x 10 matrix. Swap columns of the matrix with numbers k1 and k2 from everything is just can not swap k1 and k2
using System; using System.Collections.Generic; using System.Globalization; using System.IO; using System.Linq; using System.Text; namespace StudentSimpleProject { class Program { static void Main(string[] args) { Console.Write("Введите количество строк m:\t"); int m = int.Parse(Console.ReadLine()); Console.Write("Введите количество столбцов n:\t"); int n = int.Parse(Console.ReadLine()); int i, j; Random rand = new Random(); int[,] mass = new int[m, n]; for (i = 0; i < m; i++) { for (j = 0; j < n; j++) { mass[i, j] = rand.Next(-10, 30); Console.Write(mass[i, j] + "\t"); } Console.WriteLine("\n"); } Console.Write("Введите номер столбца k1:\t"); int k1 = int.Parse(Console.ReadLine()) - 1; Console.Write("Введите номер столбца k2:\t"); int k2 = int.Parse(Console.ReadLine()) - 1; for (i = 0; i < m; i++) { mass[i, k2] = mass[i, k1]; } Console.WriteLine("Новый массив:"); for (i = 0; i < m; i++) { for (j = 0; j < n; j++) { Console.Write(mass[i, j] + "\t"); } Console.WriteLine("\n"); } Console.ReadKey(); } } }