Guest User

Untitled

a guest
Nov 17th, 2025
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.27 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. main() {
  5.     cin.tie(0)->sync_with_stdio(0);
  6.    
  7.     int n;
  8.     while (cin >> n) {
  9.         string s;
  10.        
  11.         while (n > 0) {
  12.             s += n & 1 ? '1' : '0';
  13.             n /= 2;
  14.         }
  15.        
  16.         reverse(s.begin(), s.end());
  17.         cout << s << '\n';
  18.     }
  19. }
  20.  
Advertisement
Add Comment
Please, Sign In to add comment