Advertisement
sodafago

Untitled

Jan 20th, 2022
933
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.31 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6.     ios::sync_with_stdio(false);
  7.     cin.tie(nullptr);
  8.     cout.tie(nullptr);
  9.  
  10.     int n, to;
  11.     cin >> n >> to;
  12.     string s;
  13.     while (n > 0) {
  14.         s = "0123456789ABCDEF"[n % to] + s;
  15.         n /= to;
  16.     }
  17.     cout << s << '\n';
  18. }
  19.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement