public static void Main()
Console.WriteLine("Define the first Matrix: "+"\r\n");
Console.WriteLine("Please input the matrix's row");
m = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Please input the matrix's column");
n = Convert.ToInt32(Console.ReadLine());
int[,] first = new int[m, n];
Console.WriteLine("Define the second Matrix: " + "\r\n");
Console.WriteLine("Please input the matrix's row");
q = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Please input the matrix's column");
w = Convert.ToInt32(Console.ReadLine());
int[,] second = new int[q, w];
if (Convert.ToBoolean(n = q))
int[,] abc = new int[m, w];
for (int i = 0; i < m; i++)
for (int j= 0; j < w; j++)
for (int k = 0; k < q; k++)
abc[i, j] += first[i, k] * second[k, j];
static void matrix(int m, int n)
double[,] matrix01 = new double[m, n];
for (int i = 0; i != matrix01.GetLength(0); i++)
for (int j = 0; j != matrix01.GetLength(1); j++)
Console.WriteLine("Please input the element of the matrix,where row=" + (i+1) + " , " + "column=" + (j+1));
matrix01[i, j] = Convert.ToDouble(Console.ReadLine());
Console.WriteLine("You have already finished defining the matrix... ");
Console.WriteLine("The matrix you input is: ");
for (int i = 0; i != matrix01.GetLength(0); i++)
for (int j = 0; j != matrix01.GetLength(1); j++)
Console.Write(matrix01[i, j] + "\t");