Hey everyone, I am working with arrays, my program needs to take a list of 10 numbers and put them in each array depending on if they are even, odd, or negative. My program compiles but it does not run correctly it only displays 0 for each list. Thanks in advance
import TerminalIO.KeyboardReader;
public class evenodd
{
public static void main (String []args)
{
KeyboardReader reader = new KeyboardReader();
double[] even = new double[11];
double[] odd = new double[11];
double[] neg = new double[11];
double num;
int i;
double oddl = 0;
double evenl = 0;
double negl = 0;
System.out.print ("Enter Numbers: ");
num = reader.readDouble();
for(i = 1; i <= 9; i++)
{
System.out.print ("Enter Numbers: ");
num = reader.readDouble();
if(num > 0)
{
if(num / 2 != 0)
{
oddl = num;
odd[i] = oddl;
}
else
{
evenl = num;
even[i] = evenl;
}
negl = num;
neg[i] = negl;
}
}
System.out.println ("The Even Numbers Are: " + even[i]);
System.out.println ("The Odd Numbers Are: " +odd[i]);
System.out.println ("The Negative Numbers Are: " +neg[i]);
}
}