title: How to display hexadecimal numbers in C?
body: <p>I have a list of numbers as below:</p>
  
  <blockquote>
    <p>0, 16, 32, 48 ...</p>
  </blockquote>
  
  <p>I need to output those numbers in hexadecimal as:</p>
  
  <blockquote>
    <p>0000,0010,0020,0030,0040 ...</p>
  </blockquote>
  
  <p>I have tried solution such as:</p>
  
  <pre><code>printf("%.4x",a); // where a is an integer
  </code></pre>
  
  <p>but the result that I got is:</p>
  
  <blockquote>
    <p>0000, 0001, 0002, 0003, 0004 ...</p>
  </blockquote>
  
  <p>I think I'm close there. Can anybody help as I'm not
  so good at <code>printf</code> in C.</p>
  
  <p>Thanks.</p>