How to display values on at 2d array? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

How to display values on at 2d array?

a 5×5 grid (2d array) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 16 18 19 20 21 22 23 24 25

30th Nov 2016, 3:56 PM
Abdoulaye Seck
Abdoulaye Seck - avatar
4 Answers
+ 2
int a[5][5]; //add data to array... //print it: for (int i=0; i<5; i++){ for(int j=0; j<5; j++) sys.out.print(a[i][j]+" "); sys.out.println; }
1st Dec 2016, 12:28 AM
Petar Suvajac
Petar Suvajac - avatar
+ 2
sorry I forgot to mention in javascript
1st Dec 2016, 12:31 AM
Abdoulaye Seck
Abdoulaye Seck - avatar
+ 2
when I try this is with something like array[row][column] it displays 0 or 1
1st Dec 2016, 12:50 AM
Abdoulaye Seck
Abdoulaye Seck - avatar
0
not familiar with js but it should be more/less same, outter loop is for every row, inner is for columns in that row... I guess :P
1st Dec 2016, 12:44 AM
Petar Suvajac
Petar Suvajac - avatar