title: converting hex to binary
body: <pre><code>int hex2bin (int n)
  {
    int i,k,mask;
    for(i=16;i&gt;=0;i--)
    {
      mask = 1&lt;&lt;i;
      k = n&amp;mask;
      k==0?printf("0"):printf("1");
    }
    return 0;
  }
  </code></pre>
  
  <p>I need this to work for any hex i give as an input. Meaning <code>hex2bin(0x101)</code> and <code>hex2bin(0x04)</code> should print out their respective binary numbers.</p>