title: How to use %d as a decimal integer with %f in the same line?
body: <p>I want to design a function to print the first X(where X is an integer) digits after the decimal(from 0 to X) for a floating point number Y. For eg.
  <code>print_num(12.123456,4)</code>
  should give:</p>
  <pre><code>   12.0000000
     12.1000000 
     12.1200000
     12.1230000
     12.1234000
  </code></pre>
  <p>Here is a program that I tried to write:</p>
  <pre><code>#include&lt;stdio.h&gt;
  void printplaces(float N,int X)
  {
      for(int i =0;i&lt;=X;i++)
      {
          printf(&quot;%.%df\n&quot;,N,i);
      }
  }
  void main()
  {
      printplaces(23.23423342,5);
  }
  </code></pre>
  <p>But it just prints the output as it is:</p>
  <pre><code>%df
  %df
  %df
  %df
  %df
  %df
  </code></pre>
  <p>I want to know how I can use %d as an integer with %f on the same line.</p>