@@ -0,0 +1,1558 @@
+import java.util.Scanner;%0A%0Apublic class subtract_matrices %7B%0A%09public static void main(String%5B%5D args) %7B%0A%09%09// directions and gather user input%0A%09%09Scanner s = new Scanner(System.in);%0A%09%0A%09%09System.out.print(%22How many rows do your matrices have?: %22);%0A%09%09int rows = s.nextInt();%0A%09%0A%09%09System.out.print(%22How many columns do your matrices have? :%22);%0A%09%09int columns = s.nextInt();%0A%0A%09%09int first_matrix%5B%5D%5B%5D = new int%5Brows%5D%5Bcolumns%5D;%09%0A%09%09int second_matrix%5B%5D%5B%5D = new int%5Brows%5D%5Bcolumns%5D;%0A%09%09int result_matrix%5B%5D%5B%5D = new int%5Brows%5D%5Bcolumns%5D;%0A%0A%09%09// collect data for each matrix%0A%09%09// first matrix%0A%09%09System.out.println(%22Please enter the first matrix%22);%0A%09%09for(int row_num = 0; row_num %3C rows; row_num++) %7B%0A%09%09%09for(int col_num = 0; col_num %3C columns; col_num++) %7B%0A%09%09%09%09first_matrix%5Brow_num%5D%5Bcol_num%5D = s.nextInt();%0A%09%09%09%7D%0A%09%09%7D%0A%0A%09%09// second matrix%0A%09%09System.out.println(%22Please enter the second matrix%22);%0A%09%09for(int row_num = 0; row_num %3C rows; row_num++) %7B%0A%09%09%09for(int col_num = 0; col_num %3C columns; col_num++) %7B%0A%09%09%09%09second_matrix%5Brow_num%5D%5Bcol_num%5D = s.nextInt();%0A%09%09%09%7D%0A%09%09%7D%0A%0A%09%09// calculate results%0A%09%09for(int row_num = 0; row_num %3C rows; row_num++) %7B%0A%09%09%09for(int col_num = 0; col_num %3C columns; col_num++) %7B%0A%09%09%09%09result_matrix%5Brow_num%5D%5Bcol_num%5D = first_matrix%5Brow_num%5D%5Bcol_num%5D - second_matrix%5Brow_num%5D%5Bcol_num%5D;%0A%09%09%09%7D%0A%09%09%7D%0A%0A%09%09// print results%0A%09%09System.out.println(%22The resulting matrix is: %22);%0A%09%09for(int row_num = 0; row_num %3C rows; row_num++) %7B%0A%09%09%09for(int col_num = 0; col_num %3C columns; col_num++) %7B%0A%09%09%09%09System.out.print(result_matrix%5Brow_num%5D%5Bcol_num%5D + %22 %22);%0A%09%09%09%7D%0A%09%09%09System.out.println();%0A%09%09%7D%0A%09%7D%0A%7D%0A

subtract matrices