Masa Egart - 1 year ago 51

Java Question

I'm having trouble with user input in java, hope anyone can help :)

The user declares how big the 2d array will be(number d is the side of the square array), then inputs a number "n", which tells the program how many inputs of numbers there will be, and then needs to input these numbers (eg. if n=4, the input must be sth like : 5 17 3 20.

I have already written the same thing for a single row array

`for(i=0;i<=n;i++) {`

arr[i]=sc.nextInt();

}

but am having trouble doing basically the same for the 2d array.

Any ideas?