/* (Start of Program head Note) * Copyright and version Statement of the program (c) 2011, the Computer College of Yantai University * All rights reserved. * File Name: * Author: Shangpeng * Date of Completion: September 26, 2012 * Version number: 001 * for tasks And the description of the solution method * Input Description: * Problem Description: A two-matrix multiplication program * Program output: * Program Head Comment end/public class Demo01 {/** * * @param args * * * public static void Main (string[] args) {//TODO auto-generated method stub int[][] a={{1,2},{3,4},{5,6}};//define its own matrix int[][]
b={{1,2,3},{4,5,6}};//itself defines the matrix Printmatrix (A,B);
} static void Printmatrix (int[][] a,int[][] b) {int c[][] = new Int[a.length][b[0].length];
int x,i,j;
for (i = 0;i<a.length, i++) {for (j = 0;j<b[0].length;j++) {int temp = 0;
for (x = 0;x<b.length;x++) {temp+=a[i][x]*b[x][j];
} C[i][j] = temp;
} System.out.println ("Results are after matrix multiplication");
for (int m = 0;m<a.length;m++) {for (int n = 0;n<b[0].length;n++) {System.out.print (c[m][n]+ "\ t"); } System.out. println ();
}
}
}