Skip to content

Instantly share code, notes, and snippets.

@FloydHsiu
Last active November 2, 2016 09:04
Show Gist options
  • Save FloydHsiu/e37d059e5512142776b0428a9bcab3b7 to your computer and use it in GitHub Desktop.
Save FloydHsiu/e37d059e5512142776b0428a9bcab3b7 to your computer and use it in GitHub Desktop.
int input;
int answer[100]
int counter = 0
int i;
scanf("%d", &input);
while(input >= 1){
answer[counter] = input % 2;
input = input / 2;
counter++;
}
for(i=counter-1; i >=0; i--){
printf("%d", answer[i]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment