Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Enter your code herepublic class Massive {
- public static boolean Check(int a){
- if ( a%2==0 ) return true ;
- else return false;
- }
- public static void main(String[] args) {
- int SizeM =0;
- for (int i=2 ; i<21 ; i++)
- if (Check(i)==true) {
- SizeM = SizeM + 1;
- }
- int[] m;
- int Count=0;
- m = new int[SizeM] ;
- for (int i=2;i<21;i++) {
- if (Check(i) == true) {
- m[Count] = i;
- Count++;
- }
- }
- System.out.println(Arrays.toString(m));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement