Skip to content

Instantly share code, notes, and snippets.

@saevarb
Created November 6, 2014 01:02
Show Gist options
  • Save saevarb/427a54d77096b6930e18 to your computer and use it in GitHub Desktop.
Save saevarb/427a54d77096b6930e18 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char* argv[]) {
long n = 0;
if(argc < 2) {
printf("gief args bro\n");
return 1;
}
n = strtol(argv[1], NULL, 10);
for(int i = 0; i < (1 << n); i++) {
for(long k = 1 << (n - 1); k; k = k >> 1) {
printf("%d", (k & i) > 0);
}
printf("\n");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment