hello friend,
how to convert decimal to hexa decimal i c.
if possible, give me example program.
This is a discussion on how to convert decimal to hexa decimal in C/ within the C Programming forums, part of the General Programming Boards category; hello friend, how to convert decimal to hexa decimal i c. if possible, give me example program....
hello friend,
how to convert decimal to hexa decimal i c.
if possible, give me example program.
If you just want to print an int in hexadecimal format, then use %x or %X as the format specifier.
Yeah well, we don't do your homework for you!
Besides, hexadecimal format is a way of *displaying* a number. When you declare an int for example, the number is stored in binary, when you print it out it's explicitly converted to decimal. What I'm trying to say is that you can't store a hexadecimal number.
Unless you're trying to convert a number into a string, which holds the hexadecimal representation, in that case I'd scour previous threads on this forum.
QuantumPete
Last edited by QuantumPete; 09-03-2007 at 04:50 AM. Reason: added quote
"No-one else has reported this problem, you're either crazy or a liar" - Dogbert Technical Support
"Have you tried turning it off and on again?" - The IT Crowd
If you don't know how to do it away from a computer, I suggest you get reading. It's pretty simple stuff:
Code:To convert a number from base n to 10: eg) say the number is 12345 where n >= 6 (key n^{4} = n to the power of 4) answer: (5 x n^{0}) + (4 x n^{1}) + (3 x n^{2}) + (2 x n^{3}) + (1 x n^{4})