Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- int x;
- cin >> x;
- if (x == 0)cout << "0" << endl;
- else{
- while(x >=16){
- if (x >= 256){
- if (x%16 >= 10){
- char y;
- y = x%16 + 55;
- cout << y;
- }
- else cout << x%16;
- }
- else if(x < 256){
- if (x%16 >= 10){
- char y;
- y = x%16 + 55;
- cout << y;
- }
- else cout << x%16;
- if (x/16 >= 10){
- char y;
- y = x/16 + 55;
- cout << y << endl;
- }
- else cout << x/16 << endl;
- }
- x = x/16;
- }
- }
- }
Add Comment
Please, Sign In to add comment