In mathematics, matrix addition is the operation of adding two matrices by adding the corresponding entries together. The usual matrix addition is defined for two matrices of the same dimensions. The sum of two m × n (pronounced "m by n") matrices A and B, denoted by A + B, is again an m × n matrix computed by adding corresponding elements




        public static void Add(int[,] matrixA, int[,] matrixB)
            int columnA = matrixA.GetLength(1);
            int columnB = matrixB.GetLength(1);

            int rowA = matrixA.GetLength(0);
            int rowB = matrixB.GetLength(0);

            int[,] result = new int[rowA, columnA];
            if (columnA != columnB || rowA != rowB)
                Console.WriteLine("Matrix can not be added");

            Console.WriteLine("matrix A");

            Console.WriteLine("matrix B");
            for (int i = 0; i < rowA; i++)
                for (int j = 0; j < columnA; j++)
                    result[i, j] = matrixA[i, j] + matrixB[i, j];


            Console.WriteLine("Sum Matrix");