Advertisement
Josif_tepe

Untitled

Dec 23rd, 2022
1,066
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.33 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <set>
  4. #include <cstring>
  5. using namespace std;
  6.  
  7. int main() {
  8.     int n;
  9.     cin >> n;
  10.     string s = "";
  11.     while(n > 0) {
  12.         int ostatok = n % 2;
  13.         s += (ostatok + '0');
  14.         n /= 2;
  15.     }
  16.     reverse(s.begin(), s.end());
  17.     cout << s << endl;
  18.     return 0;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement