title: Sequence of integers using While loop
body: <p>I was given an exercise:</p>
  
  <blockquote>
    <p>Write and run a program that reads a sequence of integers until a negative integer is entered, then prints the sum of the positive even and positive odd integers. Use a While Loop.</p>
  </blockquote>
  
  <p>Basically the user have infinite amount to enter integers and it will only stop if he entered a negative integers and it will display all the number of Even and Odd.</p>
  
  <p>I tried my best to do it by myself without asking for help, but now I'm stuck.  Here's what I have so far:</p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  int main()
  {
      int n;
      int odds =0;
      int evens =0;
      cout&lt;&lt;"Enter Positive integers.  \n\t:";
      cin&gt;&gt;n;
      while (n&gt;0) {
          switch (n%2) {
          case 0:
              evens++;
              break;
          case 1:
              odds++;
          }
  
      }
      cout&lt;&lt;endl;
  
      cout&lt;&lt;"the number of odds: "&lt;&lt;odds&lt;&lt;endl;
      cout&lt;&lt;"the number of evens: "&lt;&lt;evens&lt;&lt;endl;
  
  }
  </code></pre>