C#矩阵乘法
2017-11-23 14:19:43 9 举报
static void Main(string[] args) { int[,] ajz=new int[3,3]{{1,2,3},{4,5,7},{5,7,9}}; int[,] bjz=new int[3,3]{{2,4,6,},{6,5,8},{9,1,3}}; int[,] zjz=new int[3,3]; for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { for (int k = 0; k < 3; k++) { zjz[i, j] += ajz[i, k] * bjz[k, j]; } } } for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { Console.Write("\t"+zjz[i,j]); } Console.WriteLine(); } Console.ReadLine(); }