title: How do I display even and odd numbers based on user input? - java
body: <p>Please help... I need to write a program that displays even and odd numbers based on user input, but it loops forever during my last print statement. </p>
  
  <p>Here is what I have so far, what's wrong?</p>
  
  <pre><code>import java.util.Scanner;
  public class Integer {
    public static void main(String[] args) {
    Scanner input = new Scanner(System.in);
    int n = 0;
    int odd = 0;
    int even = 0;
  
    System.out.println("How many numbers will be entered?");
    n = input.nextInt();
  
    while (n &lt; 0 || n &gt; 100) {
      System.out.println("ERROR! Valid range 0-100. RE-Enter:");
      n = input.nextInt();
    }
  
    while(n &gt;= 0) {
      System.out.println("Now enter " + n + " integers: ");
      int num = input.nextInt();
  
    while(num &gt; 0) {
      for(int i = 0; i &lt;= n; i++){
        if (i % 2 == 0) {
          even++;
        } 
        else {
          odd++;
        }
          System.out.println("You entered " + odd + " odd numbers and " + even + " even numbers.");
          }
        }
      }
    }
  }
  </code></pre>