title: Is it possible to round a double using just a printf statement?
body: <p>Obviously this is just a fraction of the code.</p>
  
  <pre><code>printf("Please enter a positive number that has a fractional part with three or more decimal places\n");
  scanf("%5.2d", &amp;x);
  printf("The number you have entered is %5.2d\n" ,x);
  </code></pre>
  
  <p>Would this automatically round the number I type in? Or is there another way to do this?</p>
  
  <p>Edit:</p>
  
  <pre><code>printf("Please enter a positive number that has a fractional part with three or more decimal places\n");
  scanf("%lf", &amp;x);
  x = x + 0.05;
  printf( "The number you have entered is %5.2lf\n", x);
  </code></pre>
  
  <p>Iv done this, but Im taking into consideration what someone had said about printf just "changing" the way it reads out.  So this is obviously not the right way.  Should I implement maybe the pow() function? Will that work with this somehow?  </p>
  
  <p>Edit2: </p>
  
  <pre><code>printf("Please enter a positive number that has a fractional part with three or more decimal places\n");
  scanf("%lf", &amp;x);
  x = x + 0.05;
  printf( "The number you have entered is %5.2lf\n", x);
  </code></pre>
  
  <p>Okay, iv gotten to the point where if i imput a number it will round to a whole number.  35.21 will round to 35, and 35.51 will round to 36 et. etc.</p>
  
  <p>How would I get 35.2178 to round to 35.22, and 35.2135 to round to 35.21.
  How would I get the certain powers of the decimal to round instead of the whole number?</p>