Advertisement
Guest User

Untitled

a guest
Jan 18th, 2018
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. public class Unit601_AV {
  2.  
  3. public static void main(String[] args) {
  4.  
  5. int[][] att = { {1, 2, 3, 4, 5}, {0, 2, 3, 4, 5}, {0, 0, 3, 4, 5}, {0, 0, 0, 4, 5}, {0, 0, 0, 0, 5} };
  6. mirrorDiaganol(att);
  7. //to do: code to print the array.
  8. for (int row = 0; row<att.length; row++){
  9. for (int col = 0; col<att[1].length; col++){
  10. System.out.print(att[att.length][att[1].length]);
  11. }
  12. System.out.println();
  13. }
  14. }
  15.  
  16. public static void mirrorDiaganol(int[][] arr) {
  17. // to do:
  18. int x = 1;
  19. for (int row = 0; row<arr.length; row++){
  20. for (int col = 0; col<arr[1].length; col++){
  21. if ((arr[arr.length][arr[1].length]) == 0){
  22. arr[arr.length][arr[1].length] = x;
  23. }
  24. }
  25. x++;
  26. }
  27. }
  28.  
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement