title: Odd Even Numbers Using Switch without user input
body: <p>Initialize two integer variables and set them to zero.  loop through each item in the array and do a calculation to determine if the number is even or odd (using the modulus operator). Using a switch statement, increment one variable for all even numbers and do the same for the other variable for any odd numbers (using the increment operator).<br>
  Output the total number of even and off numbers to the screen.</p>
  
  <p><strong>Example output:</strong></p>
  
  <pre><code>34, 53, 125, 854 8, 1045, 66, 9434, 5205, 235
  There are 5 even numbers.
  There are 5 odd numbers.
  </code></pre>
  
  <p>Here is my code</p>
  
  <pre><code>public class Switch {
      public static void main(String[] args) {
          // TODO Auto-generated method stub
  
  
          int n = 0;
          int e = 0, o = 0;
  
           for( n = 5; n &lt; 50; n++)
  
           {
  
              if(n % 2 == 0)
                       System.out.println(n);
  
  
         //e= 0; o = 0;
  
            switch(n){
                  case 1: o = 0;
                  case 3:
                  case 5:
                  case 7:
                  case 9: o++; break;
                  // these are Even
                  case 2: e = 0;
                  case 4:
                  case 6:
                  case 8:
                  case 10: e++; break;
  
                  default: System.out.println("no odd or even numbers");
              }
          }
          System.out.println("You have " + e + " even numbers:  and you have odd numbers " + o);
      }
  }
  </code></pre>
  
  <p>Here is my out put what am I doing wrong.</p>
  
  <pre><code>no odd or even numbers
  48
  no odd or even numbers
  no odd or even numbers
  You have 3 even numbers:  and you have odd numbers 3
  </code></pre>