title: How to get Gray-Code from Decimal number
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/1691074/gray-code-in-net">Gray code in .NET</a>  </p>
  </blockquote>
  
  
  
  <p>I want to get Gray code of a number from its Decimal equivalent.</p>
  
  <p><strong>Example:</strong></p>
  
  <pre><code>Dec  Gray   Binary
   0   000    000
   1   001    001
   2   011    010
   3   010    011
   4   110    100
   5   111    101
   6   101    110
   7   100    111
  </code></pre>