Advertisement
Alex_Zuev

Untitled

Mar 1st, 2015
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.96 KB | None | 0 0
  1. Enter your code herepackage com.company;
  2.  
  3. /**
  4.  * Created by Alex on 28.02.2015.
  5.  */
  6.  
  7. public class MasiveDual {
  8.     public static boolean Check(int a) {
  9.         if (a != 0)
  10.             return true;
  11.         else
  12.             return false;
  13.     }
  14.  
  15.     public static void main(String[] args) {
  16.         int m[][] = new int[7][7];
  17.         int f = 1;
  18.         for (int i = 0; i < m.length; i++) {
  19.             for (int j = 0; j < m[i].length; j++) {
  20.                 if (i == j) {
  21.                     m[i][j] = 0;
  22.                     f++;
  23.                 } else if (j == (m.length-1) - i) {
  24.                     m[i][j] = 0;
  25.                     f++;
  26.                 } else {
  27.  
  28.  
  29.                     m[i][j] = f;
  30.                     f++;
  31.                 }
  32.             }
  33.         }
  34.  
  35.  
  36.         for (int i = 0; i < m.length; i++) {
  37.             System.out.println();
  38.             for (int j = 0; j < m[i].length; j++) {
  39.                 System.out.print(m[i][j] + " ");
  40.  
  41.             }
  42.         }
  43.  
  44.  
  45.     }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement