Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public 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++;
- }
- }
- for (int i=0;i<m.length;i++){
- System.out.print(m[i]+" ");
- }
- System.out.println();
- for (int i=0;i<m.length;i++){
- System.out.println(m[i] );
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement