Menu
Question Index
...

Write a program to multiply the given matrices.

Input (Two Dimensional matrix) Output (Two Dimensional matrix)
5   3
1   2
and
4   5
2   1
11  13
14  13
1   2   3
5   1   8
4   5   6
and
10   9   88
7   8   9
19   22   17
82   85   235
184   181   574
286   277   913
-2   -4   3
6   7   8
-1   2   2
and
1   2   3
5   4   3
4   5   6
-4   -7   -10
4   7   10
46   58   70
4   5   1
4   5   1
7   19   23
and
7
19
23
146
146
939



class SimpleMatrixMultiplication
{
    public static void main(String s[])
    {
        int firstArray[][] = {{1, 2, 3, 4}, {9, 8, 7, -2}, {0, 5, -3, 7}};
        int secondArray[][] = {{0, 2, 3, 1}, {8, 9, 11, -1}, {3, 2, 1, 7}, {-5, 2, 8, 1}};
        System.out.println("Resultant matrix is :");
        int multiplicationArray[][] = multiplyMatrices(firstArray, secondArray);
        for (int[] array1d : multiplicationArray) {
        for (int element : array1d) {
        System.out.print(element + "   ");
        }
        System.out.println();
        }

    }


    public static int[][] multiplyMatrices(int firstMatrix[][], int secondMatrix[][]) {
    }

}

Doubts

Problems

Topic: Learn Arrays And Loops

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App