title: How to take the sum of only even and odd numbers? C#
body: <p>When the user enters numbers, say 3 and 7, the program adds all of the number in between and the numbers the user entered. Now I need to make it add only the even and odds in between the numbers. This is what I have so far: </p>
  
  <pre><code>static void Exercise1()
      {
          int min;
          int max;
          int sum = 0;
          int odd = 0;
          int even = 0;
  
          Console.WriteLine("Enter minimum integer: ");
          min = int.Parse(Console.ReadLine());
          Console.WriteLine("Enter maximum integer: ");
          max = int.Parse(Console.ReadLine());
         //Sum of all
          Console.Write("All: ");
           for (int x = min; x &lt;= max; x++)
              {
                  Console.Write(min);
                  min++;
                  Console.Write(" + ");
                  sum += x;
              }
           Console.Write("= ");
           Console.Write(sum + "\n");
  
          //Odd Numbers
           Console.Write("Odd: ");
           for (int x = min; x &lt;= max; x++)
           {
               if (min % 2 != 0)
               {
                   Console.Write(min);
                   min++;
                   Console.Write(" + ");
                   odd += x;
               }
  
           }
           Console.Write("= ");
           Console.Write(odd + "\n");
  
          //Even Numbers
           Console.Write("Even: ");
           for (int x = min; x &lt;= max; x++)
           {
  
               if (min % 2 == 0)
               {
                   Console.Write(min);
                   min++;
                   Console.Write(" + ");
                   even += x;
               }   
  
           }
           Console.Write("= ");
           Console.Write(even + "\n");
  
          }
  </code></pre>
  
  <p>I can find the sum of all the numbers but what I have tried here is the extent of my knowledge. I have hit a dead end.</p>