I am facing a problem with java array loops well, this is the problem
Use the space below to write main method that reads 5 integer values into an array named list. Then, use the array to output the positive values followed by the negative values and ignore zeros.
Sample Output
Enter 5 numbers: 10 -3 0 -4 9
List:
10
9
-3
-4
and this is the answer:
int [] list = new int[5];
// 1pt
Scanner read = new Scanner (System.in);
// 3pts
System.out.println("Enter 5 numbers:");
for (int i = 0; i < list.length; i++)
list[i] = read.nextInt();
// 3 pts
for (int i = 0; i < list.length; i++)
if (list[i] > 0)
System.out.println(list[i]);
// 3 pts
for(int i = 0; i < list.length; i++)
if (list[i] < 0)
System.out.println(list[i]);
but i do not know how to make them work together if you get me