1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| #include <iostream> using namespace std;
int main(int argc, char **argv){ int a,r,c=0; int ans[60]; while(cin>>a){ while(a>0){ r=a%2; ans[c]=r; c++; a=a/2; } for(int i=(c-1);i>=0;i--){ cout<<ans[i]; ans[i]=0; } cout<<"\n"; c=0; } return 0; }
|