Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- int x;
- cin>>x;
- int y;
- cin>>y;
- if(x<2||x>16||y<1||y>100) {
- cout<<"Invalid input data!"<<endl;
- return 0;
- }
- const string digits="0123456789ABCDEF";
- string result="";
- while(y>0) {
- result=digits[y%x]+ result;
- y/=x;
- }
- cout<<result;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement