title: C# Fibonacci Sequence Replication
body: <p>I'm attempting to solve the second problem on Project Euler, here is the problem:</p>
  
  <blockquote>
    <p>Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be:</p>
    
    <p>1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...</p>
    
    <p>Find the sum of all the even-valued terms in the sequence which do not exceed four million.</p>
  </blockquote>
  
  <p>So, I have set up the following:</p>
  
  <pre><code>using System;
  
  namespace ProjectEuler
  {
      class Question2
      {
          //Project Euler - Question 2
          //Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be:
          //1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
          //Find the sum of all the even-valued terms in the sequence which do not exceed four million
          static void Main()
          {
              int sum = 0;
  
              int oldNumber = 1;
              int currentNumber = 1;
              int nextNumber;
  
              while (currentNumber &lt;= 500)
              {
                  nextNumber = currentNumber + oldNumber;
  
                  if (nextNumber % 2 == 0)
                  {
                      sum += currentNumber;
                  }
              }
  
              Console.WriteLine("Project Euler - Question 2\n\nAnswer: " + sum);
              Console.ReadLine();
          }
      }
  }
  </code></pre>
  
  <p>When I run the program, there is nothing visible, just a cursor in the Windows command line.  I think that may be do the fact that currentNumber isn't getting updated, but I can't think of how to do that properly, if that even is the case.</p>