title: Why do these division equations result in zero?
body: <p>The result of all of the division equations in the below for loop is 0. How can I get it to give me a decimal e.g.:</p>
  
  <pre><code>297 / 315 = 0.30793650793650793650793650793651
  </code></pre>
  
  <p>Code:</p>
  
  <pre><code>using System;
  
  namespace TestDivide
  {
      class Program
      {
          static void Main(string[] args)
          {
  
              for (int i = 0; i &lt;= 100; i++)
              {
                  decimal result = i / 100;
                  long result2 = i / 100;
                  double result3 = i / 100;
                  float result4 = i / 100;
                  Console.WriteLine("{0}/{1}={2} ({3},{4},{5}, {6})", i, 100, i / 100, result, result2, result3, result4);
              }
              Console.ReadLine();
          }
      }
  }
  </code></pre>
  
  <h1>Answer:</h1>
  
  <p>Thanks Jon and everyone, this is what I wanted to do:</p>
  
  <pre><code>using System;
  
  namespace TestDivide
  {
      class Program
      {
          static void Main(string[] args)
          {
              int maximum = 300;
  
              for (int i = 0; i &lt;= maximum; i++)
              {
                  float percentage = (i / (float)maximum) * 100f;
                  Console.WriteLine("on #{0}, {1:#}% finished.", i, percentage);
              }
              Console.ReadLine();
          }
      }
  }
  </code></pre>