fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. void bin(int n){
  4. if (n==1){
  5. cout<<1;
  6. return;
  7. }
  8. int o=n%2;
  9. bin(n/2);
  10. cout<<o;
  11. }
  12. int main() {
  13. int n;
  14. while(cin>>n){
  15. bin(n);
  16. cout<<"\n";
  17. }
  18. }
Success #stdin #stdout 0.01s 5292KB
stdin
17 18 19 20
stdout
10001
10010
10011
10100