Prosiłbym o pomoc w znalezieniu błędu w kodzie
Console.Write("podaj ilosc wierszy pierwszej macierzy:");
int wiersze1 = int.Parse(Console.ReadLine());
Console.Write("podaj ilosc kolumn pierwszej macierzy:");
int kolumny1 = int.Parse(Console.ReadLine());
int[,] tab1 = new int[wiersze1, kolumny1];
for (int i=0; i<wiersze1;i++ )
{
Console.WriteLine("podaj elementy {0} wiersza", i+1);
for (int j = 0; j < kolumny1; j++)
{
tab1[i, j] = int.Parse(Console.ReadLine());
}
}
Console.WriteLine("twoja 1 macierz to:");
for (int i = 0; i < wiersze1 ; i++)
{
for (int j = 0; j < kolumny1; j++)
{
Console.Write("{0} ", tab1[i, j]);
}
Console.WriteLine();
}
///2macierz
Console.Write("podaj ilosc wierszy drugiej macierzy:");
int wiersze2 = int.Parse(Console.ReadLine());
Console.Write("podaj ilosc kolumn drugiej macierzy:");
int kolumny2 = int.Parse(Console.ReadLine());
int[,] tab2 = new int[wiersze2, kolumny2];
int[,] tab1tab2 = new int[wiersze1, kolumny1];
for (int i = 0; i < wiersze2; i++)
{
Console.WriteLine("podaj elementy {0} wiersza", i + 1);
for (int j = 0; j < kolumny2; j++)
{
tab2[i, j] = int.Parse(Console.ReadLine());
}
}
Console.WriteLine("twoja 2 macierz to:");
for (int i = 0; i < wiersze2; i++)
{
for (int j = 0; j < kolumny2; j++)
{
Console.Write("{0} ", tab2[i, j]);
}
Console.WriteLine();
}
///mnozenie
Console.WriteLine("\nMnozenie macierzy:");
for (int i = 0; i < wiersze1; i++)
{
for (int k = 0; k < kolumny2; k++)
{
for (int j = 0; j < kolumny1; j++)
{
tab1tab2[i, k] += tab1[i, j] * tab2[j, k];
}
}
}
Console.WriteLine("\nM1 x M2: ");
for (int i = 0; i < wiersze1; i++)
{
for (int k = 0; k < kolumny2; k++)
{
Console.Write("{0} ", tab1tab2[i, k]);
}
}