@@ -0,0 +1,2586 @@
+import java.util.Scanner;%0Apublic class Matrix %7B%0A   // To print Matrix %0A    static void printMatrix(int M%5B%5D%5B%5D, int rowSize, int colSize) %0A    %7B %0A        for (int i = 0; i %3C rowSize; i++) %0A        %7B %0A            for (int j = 0; j %3C colSize; j++) %0A            %7B%0A                System.out.print(M%5Bi%5D%5Bj%5D + %22 %22); %0A            %7D%0A  %0A            System.out.println(); %0A        %7D %0A    %7D   %0A%0A    static void multiplyMatrix(int p,int q, int a%5B%5D%5B%5D, int m, int n, int b%5B%5D%5B%5D) %0A    %7B %0A        int i, j, k;   %0A        // Print the matrices A and B %0A        System.out.println(%22First Matrix:%22);%0A        printMatrix(a, p, q); %0A        System.out.println(%22Second Matrix:%22);%0A        printMatrix(b, m, n);   %0A   %0A        %0A        if (m != q) %0A        %7B %0A            System.out.println(%22Multiplication Not Possible%22); %0A            return; %0A        %7D   %0A%0A        %0A        int c%5B%5D%5B%5D = new int%5Bq%5D%5Bn%5D; %0A  %0A%0A        %0A        for (i = 0; i %3C p; i++) %0A        %7B %0A            for (j = 0; j %3C n; j++) %0A            %7B %0A                for (k = 0; k %3C m; k++) %0A                    c%5Bi%5D%5Bj%5D += a%5Bi%5D%5Bk%5D * b%5Bk%5D%5Bj%5D; %0A            %7D %0A        %7D   %0A        // Print the result %0A        System.out.println(%22%5CnResultant Matrix:%22); %0A        printMatrix(c, p, n); %0A    %7D   %0A%0A    %0A    public static void main(String%5B%5D args) %0A    %7B%0A        int p, q, m, n;   %0A        Scanner sc = new Scanner(System.in);%0A        System.out.print(%22Enter the number of rows in the first matrix:%22);%0A        p = sc.nextInt();   %0A        System.out.print(%22Enter the number of columns in the first matrix:%22);%0A        q = sc.nextInt();  %0A        System.out.print(%22Enter the number of rows in the second matrix:%22);%0A        m = sc.nextInt();  %0A        System.out.print(%22Enter the number of columns in the second matrix:%22);%0A        n = sc.nextInt();  %0A        int a%5B%5D%5B%5D = new int%5Bp%5D%5Bq%5D;   %0A        int b%5B%5D%5B%5D = new int%5Bm%5D%5Bn%5D;        %0A           %0A        %0A            System.out.println(%22Enter all the elements of first matrix:%22);%0A            for (int i = 0; i %3C p; i++) %0A            %7B%0A                for (int j = 0; j %3C q; j++) %0A                %7B%0A                    a%5Bi%5D%5Bj%5D = sc.nextInt();%0A                %7D%0A            %7D%0A            System.out.println(%22%22);%0A            %0A           %0A            %0A            System.out.println(%22Enter all the elements of second matrix:%22);%0A            for (int i = 0; i %3C m; i++) %0A            %7B%0A                for (int j = 0; j %3C n; j++) %0A                %7B%0A                    b%5Bi%5D%5Bj%5D = sc.nextInt();%0A                %7D%0A            %7D            %0A           %0A            %0A             multiplyMatrix(p ,q, a, m, n, b);    %0A    %7D%0A%7D

Add Matrix algo