import java.util.Scanner;
public class ejercicio21 {
private Scanner teclado;
private int[][] mat;
private Scanner teclado;
public void cargar() {
teclado=new Scanner(System.in);
mat=new int[2][5];
System.out.println("Carga de la matriz por columna:");
for(int c=0;c<5;c++) {
for(int f=0;f<2;f++) {
System.out.print("Ingrese componente " + " de la fila " + f + " y la columna "+ c + " :");
mat[f][c]=teclado.nextInt();
}
}
}
public void imprimir() {
for(int f=0;f<2;f++) {
for(int c=0;c<5;c++) {
System.out.print(mat[f][c]+" ");
}
System.out.println();
}
}
public static void main(String[] ar) {
ejercicio21 ma=new ejercicio21();
ma.cargar();
ma.imprimir();
}
}
http://www.youtube.com/watch?v=yjCDmtDtqPc
No hay comentarios:
Publicar un comentario