Advertisement
awsmpshk

Untitled

Mar 1st, 2020
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.23 KB | None | 0 0
  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
Add Comment
Please, Sign In to add comment
Advertisement