title: Force printf to display a determined number of digits and remove remaining 0s
body: <p>I don't figure out how to tell printf to print a double with a variable precision.</p>
  
  <p>Where is what I actually do :</p>
  
  <pre><code>int main(void)
  {
      int digits = 4;
  
      printf("%0.*f\n", digits, 0.123456789);
      printf("%0.*f\n", digits, 5.9);
  
      return (0);
  }
  </code></pre>
  
  <p>I actually have the variable precision with the * and the digits variable, but it still prints remaining 0 after the last number.</p>
  
  <p>In order to illustrate my problem, here is what i get :</p>
  
  <pre><code>0.1234
  5.9000
  </code></pre>
  
  <p>And here is what i want :</p>
  
  <pre><code>0.1234
  5.9
  </code></pre>
  
  <p>Could you help me please?</p>