title: What is the logical error in this loop?
body: <p>for these guidelines: <br></p>
  
  <p>Write a loop that reads positive integers from standard input and that terminates when it reads an integer that is not positive. After the loop terminates, it prints out, separated by a space and on a single line, the sum of all the even integers read and the sum of all the odd integers read. Declare any variables that are needed.</p>
  
  <p>ASSUME the availability of a variable,  stdin , that references a  Scanner object associated with standard input.
  <br><br>
  I wrote this code, but it the HW software will not except it due to a logical error. I cant seem to find the logical error here. can someone point out what is wrong with it?</p>
  
  <pre><code>    int sumP=0;
      int sumO=0;
      Scanner stdin = new Scanner (System.in);
  
      System.out.println("enter an odd or even number");
  
      while (stdin.nextInt() &gt;= 0){
      if(stdin.nextInt()%2 == 0)
          sumP+= stdin.nextInt();
      else
          sumO += stdin.nextInt();
      }
      System.out.println(sumP + " " + sumO);
  </code></pre>