# SolvedThe Way To Convert Hex To Dec

#### programmer

##### Jr.Coder
Full Member
Hex = 539

convert to Dec = (16^2 = 256x5 = 1280) + (16^1 = 16x3 = 48) + (16^0 = 1x9 = 9) = 1280 + 48 + 9 = 1337

Dec = 1337

convert to Hex = 1337 / 16 = 83.5625 <- 0.5625x16 = 9 | 83/16 = 5.1875 <- 0.1875x16 = 3 | 5/16 = 0.3125 x 16 = 5 ||||| Hex = 539

when you get the last answer (0.something(x) x 16) = the last number .

********* the answer is Inverted .
935 = 539

#### programmer

##### Jr.Coder
Full Member
and you can also use the windows calculator and write the hex then select dec and it will give you the dec and write the dec then select hex and it will give you the hex .

#### kokole

##### k
Dank Tier Donator
Nobleman
C++:
``````DWORD hex = 0x5D;
int converted = (int)hex;``````
problem? trolololo

Last edited:

#### voidisalive

##### Jr.Coder
Full Member
Nobleman
What is your problem are you trying to convert from decimal to hexadecimal? using code if yes I made a video that shows how to convert from decimal numerals to hexadecimal

Watch video here

Greets,

voidisalive

C++:
``````DWORD hex = 0x5D;
int converted = (int)hex;``````
problem? trolololo

#### programmer

##### Jr.Coder
Full Member
This Is Not A C++ Code Its The Way To Convert Using Calculator