test

test



import java.util.Scanner;



public class Main {

public static void main(String[] args) {

Scanner input = new Scanner(System.in);
int nums[][];
int filas;
int columnas;

System.out.println("Introduce filas:");
filas = input.nextInt();
System.out.println("Introduce columnas:");
columnas = input.nextInt();
nums = new int[filas][columnas];

for (int i = 0; i < filas; i++) {
for (int j = 0; j < columnas; j++) {
System.out.println("Introduzca un numero");
nums [i][j] = input.nextInt();
}
}
for (int i = 0; i < filas; i++) {
for (int j = 0; j < columnas; j++) {
System.out.println("[" + i + "]" + " " + "[" + j + "]:");
System.out.printf("%2d ", nums[i][j]);
System.out.println();
}
}
}
}


Report Page