title: How to divide float by integer when both are variables?
body: <p>I am writing a program in C. I have two variables one of which is integer and the other one is float. I want to divide the float by the integer and want to get result in float. I am doing the following:</p>
  
  <pre><code>int a;
  float b=0,c=0;
  scanf("%d",&amp;a);
  </code></pre>
  
  <p>I then do some computations on <code>b</code> so it has a non-zero value.</p>
  
  <pre><code>c = b/(float)a;
  printf("c = %d\n", c);
  </code></pre>
  
  <p>The problem is I am getting <code>c</code> printed as a rounded number (integer) rather than a float value.</p>
  
  <p>How can I get <code>c</code> as a float value?</p>