Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- output now:-
- 0
- 1 2
- 3 4 5
- 6 7 8 9
- // Array row column print..in 2D Diamontional new print..
- //initilize array create just row, not column
- int [][] num = new int[4][];
- //first row column declare..
- // 0 num row a column thakbe 1 ta.
- // 1 num row a column thakbe 2 ta.
- //row er under a column create, row num[0] a akta column new int[1]; create korlam.
- num[0] = new int[1];
- num[1] = new int[2];
- num[2] = new int[3];
- num[3] = new int[4];
- //initlize the value.
- int k = 0;
- //create row with every looping 1 add to column with asign to num..
- for (int i =0; i<4; i++){
- for (int j =0; j<i+1; j++){
- // num asign korte hobe 1 , 1 kore barate hobe.
- num[i][j] = k;
- k++;
- }
- }
- // display show this array now...
- for (int i=0; i<4; i++){
- for (int j=0; j<i+1; j++){
- System.out.print(num[i][j]+" ");
- }
- System.out.println();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement