SHARE
TWEET

Untitled

a guest Oct 13th, 2019 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<iostream>
  2. #include<vector>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     unsigned long long int x;
  8.     int r, z, n;
  9.     vector<char> v;
  10.     cin >> x >> r;
  11.     while (x > 0)
  12.     {
  13.         z = x % r;
  14.         x /= r;
  15.         if (z < 10) v.push_back(z + 48);
  16.         else
  17.             v.push_back(z + 55);
  18.     }
  19.     n = v.size();
  20.     for (int i = n - 1; i >= 0; i--)
  21.     {
  22.         cout << v[i];
  23.     }
  24.     return 0;
  25. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top