Skip to content

Instantly share code, notes, and snippets.

@dd1994
Created April 29, 2014 09:50
Show Gist options
  • Save dd1994/11395621 to your computer and use it in GitHub Desktop.
Save dd1994/11395621 to your computer and use it in GitHub Desktop.
#include<stdio.h>
void func(int);
int main(void)
{
int n;
while(scanf("%d", &n) != EOF)
{
func(n);
}
return 0;
}
void func(int n)
{
int a[32], i, j;
i = n;
for(j = 0; i != 0; j++)
{
a[j] = i % 2;
i /= 2;
}
for(j--; j>=0; j--)
{
printf("%d", a[j]);
}
printf("\n");
}
@dd1994
Copy link
Author

dd1994 commented Apr 29, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment