import java.io.BufferedReader; import java.io.IOException; import java.io.

InputStreamReader; public class sumam { public static void main(String[] args) throws NumberFormatException, IOE xception { BufferedReader numero = new BufferedReader (new InputStreamReade r(System.in)); int mat[][],mat1[][],matr[][],a,b=0,c=0,d=0,z,e = 0,f = 0,y; System.out.println("introduce el rango de tu columna"); a =Integer.parseInt(numero.readLine()); System.out.println("introduce el rango de tu renglon"); b =Integer.parseInt(numero.readLine()); mat = new int [a][b]; mat1 = new int [a][b]; matr= new int [a][b]; z=0; y=0; System.out.println("ingresa los datos de tu matriz 1"); for(c=0;c<a;c++){ for(d=0;d<b;d++){ System.out.println("ingresa valor posicion "+z++ ); mat[c][d] =Integer.parseInt(numero.readLine()); } } System.out.println("ingresa los datos de tu matriz 2"); for(c=0;c<a;c++){ for(d=0;d<b;d++){ System.out.println("ingresa valor posicion "+y++ ); mat1[c][d] =Integer.parseInt(numero.readLine()); } } for(c=0;c<a;c++){ for(d=0;d<b;d++){ matr[c][d]=mat[c][d]+mat1[c][d]; } } for(c=0;c<a;c++){ for(d=0;d<b;d++){ System.out.println(matr[c][d]+" "); } System.out.println(); } } }

Sign up to vote on this title
UsefulNot useful