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


using System;

class Program
{
    static void Main()
    {
        int N = 3;
        int M = 3;
        int P = 1;
        int Q = 3;

        int[,] A =
        {
            { 1, 2, 1 },
            { 2, 2, 2 },
            { 3, 1, 3 }
        };

        // Меняем местами строки P и Q
        for (int j = 0; j < M; j++)
        {
            int temp = A[P - 1, j];
            A[P - 1, j] = A[Q - 1, j];
            A[Q - 1, j] = temp;
        }

        // Выводим результат
        Console.WriteLine("Новая матрица:");

        for (int i = 0; i < N; i++)
        {
            for (int j = 0; j < M; j++)
            {
                Console.Write(A[i, j] + " ");
            }
            Console.WriteLine();
        }
    }
}