title: Adding float values in c
body: <p>Why does f is 0.0 even after adding 0.1?</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  int main()
    {
      float f=0.0f;
      f = f + 0.1f;
      printf("f %f \n",&amp;f);
      return 0;
    }
  </code></pre>
  
  <p>Sorry for that I messed up with original question</p>
  
  <p>Why these two values are not ? Is this because of precision.
  Sorry I have to ask this question here because I'm blocked I can't ask more questions</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  int main()
  {
      float f=0.0f;
      int i;
  
      for(i=0;i&lt;10;i++)
            {f = f + 0.1f; }
  
      if(f == 1.0f)
              printf("f is 1.0 \n");
      else
              printf("f %f is NOT 1.0\n",f);
  
      return 0;
  }
  </code></pre>