Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package basicos10matrices;
- public class Basicos10matrices {
- public static void main(String[] args) {
- /* Muestra por pantalla el array bidimensional que creaste
- en el ejercicio anterior. */
- int[][] matriz = {{1,2,3,4,5,},{6,7,8,9,10},{11,12,13,14,15}};
- for(int i = 0; i < matriz.length;i++){
- for(int j = 0; j < matriz[i].length;j++){
- System.out.print(matriz[i][j] + " ");
- }
- System.out.println("");
- }
- /* Muestra por pantalla el elemento que se encuentra en la fila 0 columna 3. */
- for(int i = 0; i < matriz.length;i++){
- for(int j = 0; j < matriz[i].length;j++){
- }
- }
- System.out.print(matriz[0][3] + " ");
- /* Muestra por pantalla el elemento que se encuentra en la fila 1 columna 2. */
- for(int i = 0; i < matriz.length;i++){
- for(int j = 0; j < matriz[i].length;j++){
- }
- }
- System.out.print(matriz[1][2] + " ");
- /* Muestra por pantalla el elemento que se encuentra en la fila 2 columna 4. */
- for(int i = 0; i < matriz.length;i++){
- for(int j = 0; j < matriz[i].length;j++){
- }
- }
- System.out.print(matriz[2][4] + " ");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement