Advertisement
Guest User

Esame

a guest
Jan 29th, 2020
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.54 KB | None | 0 0
  1. public class Esame{
  2.  
  3.     public static boolean[][] e1(int[][] a){
  4.         if(a!=null){
  5.             boolean perogniA;
  6.             boolean[][] b=new boolean[a.length][];
  7.             for(int i=0; i<a.length; i++){
  8.                 b[i]=new boolean[a[i].length];
  9.             }
  10.  
  11.             for(int i=0; i<a.length; i++){
  12.                 for(int j=0; j<a[i].length; j++){
  13.                     perogniA=true;
  14.                     for(int x=0; perogniA&&x<=i; x++) {
  15.                         for(int y=0; perogniA&&y<=j&&y<a[x].length; y++){
  16.                             perogniA=a[x][y]%2==0;
  17.                         }
  18.                     }
  19.                     b[i][j]=perogniA;
  20.                 }
  21.             }
  22.             return b;
  23.         }
  24.         else return null;
  25.     }
  26.  
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement