Masa Egart - 7 months ago 36

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?

Source (Stackoverflow)