title: How to only print decimals using printf if the number of decimals is greater than 0?
body: <p>How would I go about using the printf() function to print a floating point number in such a way that I only print the decimal part if it is not 0? Examples:</p>
  
  <pre><code>1.0 -&gt; 1
  2.0 -&gt; 2
  1.5 -&gt; 1.5
  2.25 -&gt; 2.25
  </code></pre>
  
  <p>etc.</p>