#include<math.h>
#include<string.h>
char st[10009],a[10009];
int j,len,i,b,num,k,ch;
void int_to_binary(int ch)
{
j=0;
i=0;
while(ch>0)
{
b = ch%2;
a[i++] = b+48;
ch = ch/2;
}
for(k=i-1;k>=0;k--)
st[j++]=a[k];
st[j]='\0';
puts(st);
}
int main()
{
while(scanf("%d",&ch)==1)
{
int_to_binary(ch);
//printf("\n");
}
return 0;
}
No comments:
Post a Comment