Problem Description
Give you a number on base ten,you should output it on base two.(0 < n < 1000)
Input
For each case there is a postive number n on base ten, end of file.
Output
For each case output a number on base two.
Sample Input
1 2 3
Sample Output
1 10 11
1 #include <cstdio> 2 int main() 3 { 4 int n, i, ans[11]; 5 while(~scanf("%d",&n)) 6 { 7 if(n==0) 8 { 9 printf("0 "); 10 } 11 for(i=0;n;i++) 12 { 13 ans[i]=n%2; 14 n=n/2; 15 } 16 for(i--;i>=0;i--) 17 { 18 printf("%d",ans[i]); 19 } 20 printf(" "); 21 } 22 return 0; 23 }