How do you convert decimal in integer to hexadecimal in integer? [closed]

If you have an integer value, and you want to print it just do the following (in C):

int number = 555;
printf("%d",number); //this prints number in decimal

printf("%x",number); //this prints number in haxadecimal

You must not forget, to a machine, there are only 0’s and 1’s.
You just have to define the way you want to print it

In C++:

int number = 555;
std::cout << std::hex << number << std::endl; //this will print the number in hexadecimal

Browse More Popular Posts

Leave a Comment