Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- main() {
- cin.tie(0)->sync_with_stdio(0);
- int n;
- while (cin >> n) {
- string s;
- while (n > 0) {
- s += n & 1 ? '1' : '0';
- n /= 2;
- }
- reverse(s.begin(), s.end());
- cout << s << '\n';
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment