title: When to use %d and %f in C?
body: <p>I'm new to C programming, but decent in Java, my question is when do we use %d and %f? In what situation? For example, based on the code block given below, if I was asked to take (int)a*(float)y, do I take it as a %d or as a %f? </p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  int main()
  {
      int a = 2;
      float y= 1.5;
      printf("%d \n", a*y);  //do I take this?
      printf("%f", a*y);    //do I take this?
      return 0;
  }
  </code></pre>
  
  <p><strong>Output:</strong> </p>
  
  <p>745417384<br>
  3.000000</p>