Advertisement
Alex_Zuev

Untitled

Feb 26th, 2015
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.62 KB | None | 0 0
  1. Enter your code herepublic class Massive {
  2.     public static boolean Check(int a){
  3.        if ( a%2==0 )      return  true ;
  4.         else return false;
  5.     }
  6.  
  7.  
  8.     public static void main(String[] args) {
  9.         int SizeM =0;
  10.         for (int i=2 ; i<21 ; i++)
  11.             if (Check(i)==true) {
  12.                 SizeM = SizeM + 1;
  13.                             }
  14.  
  15.         int[] m;
  16.         int Count=0;
  17.         m = new int[SizeM] ;
  18.         for (int i=2;i<21;i++) {
  19.             if (Check(i) == true) {
  20.                 m[Count] = i;
  21.                 Count++;
  22.             }
  23.         }
  24.  
  25.         System.out.println(Arrays.toString(m));
  26.  
  27.  
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement