Created
July 3, 2017 09:55
-
-
Save madcoder2k17/009b2d7a0eb86d636790a663a7437daa to your computer and use it in GitHub Desktop.
It is a snippet of integer to binary.
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 display_binary_n(int dec) | |
{ | |
const int size = sizeof(int) * 8 ; | |
unsigned int current; | |
int i; | |
for( i = size - 1 ; i >= 0 ; i--) | |
{ | |
current = 1<<i; | |
printf("%d",( (current & dec) != 0) ? 1: 0); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment