Speed up development with full-stack environments for every branch.

Learn More

Matriz NXN [Java]

Forked from Basic Java Example.

0 Runs 3 Views 0 Copies
Saved

Saved

pepe12 1

pepe12
published 14 days ago

    import java.util.Scanner;
    public class HelloWorld {
      public static void main(String[] args) {
          int i;
    			int j;
    			int n;
    			int N;
    			
    			Scanner dato = new Scanner (System.in);
    			Scanner sc = new Scanner(System.in);
    			
    			System.out.println("Introduce el Numero de Columnas"); 
    			n = sc.nextInt();
    			
    			System.out.println("Introduce el Numero de Filas"); 
    			N = sc.nextInt();
    			
    			int matriza[][]=new int[n][N];
    
    			
    			System.out.println("Escribir datos de la matriz ");
    
    			    for (i=0;i<=n-1;i++){
    			        for (j=0;j<=N-1;j++){
    			            System.out.print("Escribir valor " + i + " , " + j + " : ");
    			            matriza [i][j] = dato.nextInt();
    			        }
    			    }
    			    System.out.println("MATRIZ = "+n+" X "+N);
    			    for (i=0;i<=n-1;i++){
    			for (j=0;j<=N-1;j++){
    			System.out.print(matriza[i][j]+" ");
    			}
    			System.out.println("");
    			}
    			}
    }
    
    
    
    
    
    
    Please login/signup to get access to the terminal.

    Your session has timed out.

    Dismiss (the page may not function properly).