标签:style blog io color ar os sp for 文件
1 #include <stdio.h> 2 #include <string.h> 3 4 int main(){ 5 int n; 6 char s[100]; 7 int i; 8 int length; 9 10 while(scanf("%d",&n)!=EOF){ 11 if(n==0){ 12 printf("0\n"); 13 continue; 14 } 15 16 i=0; 17 while(n){ 18 s[i]=n%2+‘0‘; 19 i++; 20 n/=2; 21 } 22 s[i]=‘\0‘; 23 length=strlen(s); 24 25 for(i=length-1;i>=0;i--) 26 printf("%c",s[i]); 27 28 printf("\n"); 29 } 30 31 return 0; 32 }
标签:style blog io color ar os sp for 文件
原文地址:http://www.cnblogs.com/zqxLonely/p/4098231.html