fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int n, a[100];
  5. int f(int n)
  6. {
  7. if(!n) return n;
  8. return n % 2 + 10 * f(n / 2);
  9. }
  10. int main() {
  11. cout << f(15);
  12. return 0;
  13. }
Success #stdin #stdout 0.01s 5272KB
stdin
15
stdout
1111