- 4

Array

int [] myArray = new int {30,29,28,27,26,5,4,3,2,1}; // new array here; // logic for writing to new arrays in this loop. for(int i =0; i<_; i++){ } // output in this loop. for( Create three arrays. Fill one array with numbers, enter even numbers into the second, and add odd numbers from the first array to the third.

23rd Jun 2021, 2:15 PM
Best of Sport
Best of Sport - avatar
5 odpowiedzi
+ 1
Martin Taylor Can you pls check my answer?
24th Jun 2021, 2:04 AM
Atul [Inactive]
+ 1
Martin Taylor Can you tell me what you are doing in 23rd line?
24th Jun 2021, 7:15 AM
Atul [Inactive]
+ 1
Great thanks Martin Taylor
24th Jun 2021, 12:17 PM
Atul [Inactive]
0
public class Program { public static void main(String[] args) { // Array int [] myArray = {30,29,28,27,26,5,4,3,2,1}; // new array here; // logic for writing to new arrays in this loop. System.out.println ("Only numbers ->\n"); for(int i =0; i<myArray.length; i++){ System.out.print (myArray[i]+","); } System.out.println("\nEven numbers->\n"); // output in this loop. for(int i=0;i<myArray.length;i++) { if(myArray[i]%2==0) System.out.print (myArray[i]+","); } /* Create three arrays. Fill one array with numbers, enter even numbers into the second, and add odd numbers from the first array to the third.*/ } }
23rd Jun 2021, 2:21 PM
Atul [Inactive]
0
Now you do it for odd numbers by yourself
23rd Jun 2021, 2:22 PM
Atul [Inactive]