Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class TooDeez {
- public static void main(String[] args) {
- int[][] arr=new int[5][5];
- int[][] grid={{1,2,3,4,5,6,7,8},
- {2,3,4,5,6,7,8,9},
- {3,4,5,6,7,8,9,0},
- {0,9,8,7,6,5,4,3},
- {4,3,2,5,6,7,3,9},
- {4,5,6,1,4,8,9,0},
- {3,2,1,5,6,7,8,9},
- {3,2,5,6,7,1,2,7}
- };
- int[]nums={1,2,3,4,5,6,7,8,9,0};
- arr[3][4]=5;
- int n=arr[1][2];
- grid[1][1]=10;
- System.out.println(grid[5][5]);
- for(int i=0; i<grid.length; i++){//row loop
- for(int j=0; j<grid[i].length; j++){//col loop
- System.out.print(grid[i][j]+",");
- }
- System.out.println();
- }
- int count=0;
- for(int row=0; row<grid.length; row++){
- for(int col=0; col<grid[row].length; col++){
- if(row%2==0){
- grid[row][col]=count;
- }
- else {
- int lastOne = grid[row].length - col - 1;
- grid[row][lastOne] = count;
- }
- count++;
- }
- }
- for(int[]row: grid){
- for(int i: row){
- System.out.print(i+", ");
- }
- System.out.println();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement