Last active
August 29, 2015 14:00
-
-
Save Prince781/11023503 to your computer and use it in GitHub Desktop.
Prints out binary form of whatever is given.
This file contains hidden or 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
| #include <stdio.h> | |
| void printb(unsigned long v) { | |
| if (v>>1 > 0) printb(v>>1); | |
| putchar((v&1) + '0'); | |
| } | |
| int main(int argc, char *argv[]) { | |
| if (argc > 1) | |
| printb(atol(argv[1])); | |
| printf("\n"); | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment