Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import acm.program.ConsoleProgram;
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- /**
- *
- * @author prb7
- */
- public class Problema4 extends ConsoleProgram {
- public void run(){
- }
- public int[][] matrixMultiplication (int[][]left,
- int[][]right){
- int[][] multiplication = new int [left.length][right[0].length];
- for(int i=0; i<multiplication.length; i++){
- for(int j=0; i< multiplication[0].length;j++){
- /*int res = 0;
- for(int k=0;k<left[0].length;k++){
- res+=left[i][k]*right[k][j];
- }*/
- //multiplication[i][j]=res;
- multiplication[i][j]=calcule(i,j,left,right);
- }
- }
- return multiplication;
- }
- public int calcule(int i, int j,int[][]left,
- int[][]right){
- int res = 0;
- for(int k=0;k<left[0].length;k++){
- res+=left[i][k]*right[k][j];
- }
- return res;
- }
- }//end public class
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement