public static void Main()
int[,] matrixA = new int[3, 3] { { 1, 2, 3 }, { 1, 2, 4 }, { 3, 2, 4 } };
int[,] matrixB = new int[3, 2] { { 1, 2 }, { 2, 3 }, { 3, 4 } };
int[,] matrixC = new int[matrixA.GetLength(0), matrixB.GetLength(1)];
if (matrixA.GetLength(1) != matrixB.GetLength(0))
Console.WriteLine("Matice neni mozne mezi sebou nasobit.");
for (int i = 0; i < matrixA.GetLength(0); i++)
for (int k = 0; k < matrixB.GetLength(1); k++)
for (int j = 0; j < matrixA.GetLength(1); j++)
element += matrixA[i, j] * matrixB[j, k];
Console.WriteLine("VYSLEDEK NASOBENI MATIC");
Console.WriteLine("\nMatice A:\n");
for (int i = 0; i < matrixA.GetLength(0); i++)
for (int j = 0; j < matrixA.GetLength(1); j++)
Console.Write(matrixA[i, j] + " ");
Console.WriteLine("\nMatice B:\n");
for (int i = 0; i < matrixB.GetLength(0); i++)
for (int j = 0; j < matrixB.GetLength(1); j++)
Console.Write(matrixB[i, j] + " ");
Console.WriteLine("\nVysledek nasobeni - matice C:\n");
for (int i = 0; i < matrixC.GetLength(0); i++)
for (int j = 0; j < matrixC.GetLength(1); j++)
Console.Write(matrixC[i, j] + " ");