title: How do I calculate a percentage of a number in C#?
body: <p>I am new to C# and I am using windows forms. I want to calculate percentage of a number by using simple math. For example:</p>
  
  <p>Calculate 25% of 80. </p>
  
  <pre><code>double result` = (80 / 100) * 25
  </code></pre>
  
  <p>Result = 20</p>
  
  <p>Another example: 25% of 30 = 7.5</p>
  
  <p>However, when I tested this method of calculating the percentage, I always get zero result in <code>MessageBox.Show()</code></p>
  
  <pre><code>private void button1_Click(object sender, EventArgs e)
  {
      double result;             
  
      result = (80 / 100) * 25;
      MessageBox.Show(result.ToString());
  }
  </code></pre>
  
  <p>The <code>MessageBox.Show()</code> always shows shows zero result, I tried <code>MessageBox.Show(result.ToString("F"))</code> and <code>MessageBox.Show(result.ToString("0.00"))</code> and the result still zero. I have no idea why I am getting zero. Please help me how to calculate the percentage. </p>
  
  <p>Thank you</p>