Last active
March 12, 2017 22:03
-
-
Save wtarr/3403f619e683547e757dc4deb4d7441b to your computer and use it in GitHub Desktop.
Int to bit representation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Main() | |
{ | |
for (var i = 0; i <= 16; i++) | |
{ | |
Console.WriteLine($"{i.ToString().PadLeft(2, '0')} {Convert.ToString(i, 2).PadLeft(8, '0')}"); | |
} | |
} | |
// 00 00000000 | |
// 01 00000001 | |
// 02 00000010 | |
// 03 00000011 | |
// 04 00000100 | |
// 05 00000101 | |
// 06 00000110 | |
// 07 00000111 | |
// 08 00001000 | |
// 09 00001001 | |
// 10 00001010 | |
// 11 00001011 | |
// 12 00001100 | |
// 13 00001101 | |
// 14 00001110 | |
// 15 00001111 | |
// 16 00010000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment