title: Trying to get the odd Numbers to Print
body: <p>I have a Program that asks a user to input positive numbers. Then the program prints out the user input then takes the evens out and displays the evens.Now when i try to display the odds it prints out both even and odd numbers.. i have the if statement if(oddNum%2 ! =0)// meaning if not even execute the following.. cant seem to figure out my mistakes. </p>
  
  <pre><code>            System.out.println("\n");
              System.out.println("Here is the new even array: ");
              for(j=0; j&lt;i;j++)
              {
                  if (oddNum[j]%2 == 0)//if odd num equals zero separate the evens
                  {
                      System.out.println("evenNum1:"+evenNum);
                  evenNum[evenIndex]=oddNum[j];//sorts the even numbers to the next array
                  evenIndex++;
  
                  }
              }
  
              if(evenIndex !=0)
              {
              for(j=0;j&lt;evenIndex;j++)
              {
                  if(evenNum[j]&gt;0)
                  {
                      System.out.println(evenNum[j]);
                  }
              }
  
              }
              System.out.println("\n");
              System.out.println("Here is the new odd array: ");
              for(b=0;b&lt;i;b++)
              {
                  if(oddNum[b]%2!=0 )//if odd
                  {
  
                      oddNum[oddIndex]=evenNum[b];//sorts the input numbers to the next array
                      oddIndex++;
  
  
  
                  }
              }
              if(oddIndex!=0)
              {
                  for(b=0;b&lt;oddIndex;b++)
                  {
                      if(oddNum[b]&gt;0)
                      {
                          System.out.println(oddNum[b]);
                      }
                  }
              }
       }
  
   }
  </code></pre>