title: Why does casting this double to an int give me 0?
body: <p>Sorry this has been confusing me for hours and nothing comes up on google about this. I'm programming in C, trying to convert decimal to binary, and I'm confused as to why this keeps giving me the right amount as input but the integer value is always 0.</p>
  
  <p>even if I properly cast input as an int, it doesn't work (ie: int integer = (int) input;</p>
  
  <pre><code>main() {
  double input;
  scanf("%d", &amp;input);
  printf("input: %d \n", input);  // this will print fine
  int integer = input;            // stores nums before decimal
  printf("integer:%i\n", integer);   // this always prints 0
  </code></pre>