title: How to read a number with leading 0's as one int using scanf in C?
body: <p>I am using C to read integer data using <code>scanf("%i", &amp;myInt)</code>. I know for this particular input the data will ALWAYS be three digits. However, sometimes I need to read a number with leading 0's like 001 or 078. When <code>scanf()</code> reads a number with a leading zero it will not pick up the subsequent digits. For example, when I read 078 <code>scanf</code> reads 7 then the next <code>scanf</code> will read the 8. I would like <code>scanf</code> to read 78. Can someone tell me how to do this properly? Here is a code example:</p>
  
  <pre><code>int x;
  
  while (scanf("%i", &amp;x) != EOF) {
  
     //do operations on each of the digits
  
  }
  </code></pre>