Advertisement
awsmpshk

Untitled

Mar 1st, 2020
129
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. void transfer(int n) {
  6. if (n > 1) {
  7. transfer(n / 2);
  8. cout << n % 2;
  9. }
  10. else {
  11. cout << n;
  12. return;
  13. }
  14. }
  15.  
  16. int main() {
  17. int n;
  18. cin >> n;
  19. transfer(n);
  20. return 0;
  21. }
Advertisement
RAW Paste Data Copied
Advertisement