title: Wrong double calculation in C?
body: <p>I am using DevC++ 4.9, running on WinXP SP3 (32bit), here is the code:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  main(int argc, char *argv[])
  {
      double value;
  
      int i;
  
      printf("Enter double: ");
      scanf("%lf", &amp;value);
      i = value*100;
      printf("double: %lf\n", value);
      printf("int: %d\n", i);
  
    system("PAUSE");  
  }
  </code></pre>
  
  <p>I have entered different values and here are the results:</p>
  
  <p>Test 1:</p>
  
  <p><img src="https://i.stack.imgur.com/cKIpU.png" alt="enter image description here"></p>
  
  <p>Test 2:</p>
  
  <p><img src="https://i.stack.imgur.com/3yykh.png" alt="enter image description here"></p>
  
  <p>Test 3:</p>
  
  <p><img src="https://i.stack.imgur.com/WYwde.png" alt="enter image description here"></p>
  
  <p>Why Test 1 and Test 2 displayed different results??</p>