title: C program to round numbers, rounded to second position after the decimal place
body: <p>I am writing a simple program to round numbers. It works fine when I enter something like 1.4 (gives me 1.0) or 2.6 (gives me 3.0). But when I enter 1.45, it should give me 1.5 but it prints 1.0. Or for 2.85 (should be 2.9, it prints 3.0). How do I make this work? I cannot use any functions.</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  const float add = 0.5;
  int main(void)
  {
        float v;
  
         printf("Please enter a value to be rounded: ");
         scanf("%f", &amp;v);
  
         v = v + add;
         v = (int)v;
  
         printf("The rounded value is %.2f", v);
  
        return 0;
  }
  </code></pre>