Untitled

mail@pastecode.io avatar
unknown
java
2 years ago
672 B
2
Indexable
Never
Scanner kb=new Scanner(System.in);
        System.out.println("Enter the number of rows: ");
        int n=kb.nextInt();
        int [] [] arr=new int[n] [] ;
        for(int i=0;i<arr.length;i++){
            System.out.println("Enter the number of columns in row number " +(i+1)+": ");
            int m=kb.nextInt();
            arr[i]=new int[m] ;
            System.out.println(" Enter "+m+" values :") ;
            for(int j=0;j<arr[i].length;j++){
                arr[i] [j] =kb.nextInt();
            }
        }

        for (int[] ints : arr) {
            for (int anInt : ints) {
                System.out.println("Value: " + anInt);
            }
        }