title: How do I control the number of decimal places printed in a float?
body: <p>I want to control how many digits will be printed after the decimal point when printing a float.</p>
  
  <p>The function will take <code>n</code> as an input.</p>
  
  <p>For example, if I have <code>double F = 123.456789</code>, and:</p>
  
  <ul>
  <li>If n = 2, then output <code>123.46</code></li>
  <li>If n = 3, then output <code>123.457</code></li>
  <li>If n = 10, then output <code>123.4567890000</code></li>
  </ul>