title: displaying the factors of a number
body: <p>I'm trying to get all the factors of a number provided by a user and after a button click displaying all the factors on a MessageBox. </p>
  
  <p>This is what <strike>my code</strike> code taken from <a href="https://stackoverflow.com/questions/4549482/getting-factors-of-a-number">Getting Factors of a Number</a> answer by <a href="https://stackoverflow.com/users/61974/mark-byers">Mark Byers</a> looks like, I thought I was pretty close, but I'm displaying the number of factors not the actual factor numbers. </p>
  
  <p>For example if the user types in 10 and uses a button click, the MessageBox displays the number 4, but i'm wanting it to display the actual factors of 10 which should be 1,2,5,10.</p>
  
  <p><strong>*how can I display the factors?</strong></p>
  
  <pre><code>public int Divisors(int fact)
      {
          int number = int.Parse(textBox2.Text);
          int factorCount = 0;
          int sqrt = (int)Math.Ceiling(Math.Sqrt(number));
  
          for (int i = 1; i &lt; sqrt; i++)
          {
              if (number % i == 0)
              {
                  factorCount += 2; //  We found a pair of factors.
              }
          }
  
          // Check if our number is an exact square.
          if (sqrt * sqrt == number)
          {
              factorCount++;
          }
  
          return factorCount;
      }
  
  private void ShowallButton_Click(object sender, EventArgs e)
      {
          int input = int.Parse(textBox2.Text);
          double output = Divisors(input);
  
          MessageBox.Show(+output + "");
      }
  </code></pre>