title: C - how to divide floats?
body: <p>I get input from command line as a int d. Now I am facing this problem:</p>
  
  <pre><code>float a,b;
  int d;
  float piece;    
  printf("Please enter the parts to divide the interval: ");
  scanf("%d", &amp;d);
  
  a=0;
  b=1;
  
  piece=b-a/(float)d;
  printf("%f\n",piece);
  </code></pre>
  
  <p>All I want is to printf some float number dependent on &amp;d. e.g. when I write here 5, I would get 0.20000, for 6 - 0,166666 but I am still getting 1.000000 for all numbers, does anyone knows solution?</p>