title: prime numbers c#
body: <p>I'm new to C#. And I would like to program something like, displaying the prime numbers in a listbox if user will input any integer in the textbox. (that means, if they write 10, it will display the prime numbers from 0-10, or 20 from 0-20, etc).</p>
  
  <p>What should I consider first, before I do the programming?
  I know there are many examples in the internet, but first I would like to know what will I need?</p>
  
  <p>Thanks for the tip;-)</p>
  
  <p>===
  Thanks guys. So you're suggesting that it's better to do it first in the Console application?
  I did an example of "For Loop" using Console Application a very simple one, but then when I tried to do it in the Windows Form Application, I'm not sure how to implement it.
  I'm afraid that if I keep doing examples in the Console, then I'll have difficulty to do it in Windows Form Apps.
  What do you think?</p>
  
  <p>======
  Hello again,</p>
  
  <p>I need some feedback with my code: </p>
  
  <pre><code>        Console.WriteLine("Please enter your integer: ");
          long yourInteger;
          yourInteger = Int32.Parse(Console.ReadLine());
  
          //displaying the first prime number and comparing it to the given integer
          for (long i = 2; i &lt;= yourInteger; i = i + 1)
          {
              //Controls i if its prime number or not
              if ((i % 2 != 0) || (i == 2))
              {
                  Console.Write("{0} ", i);
              }
  
          }
  </code></pre>