Hex 2 Binary 2 Octal


E-mail this post



Remember me (?)



All personal information that you provide here will be governed by the Privacy Policy of Blogger.com. More...



General Method for Transforming Numbers - Number we want to transform uses base X: we would like to transform this number into new one, that uses Y base. In this case we will use method of continuous dividing and multiplying (dividing numbers left of comma (,) with Y and multiplying numbers on the right side of comma, by Y - rational numbers). This method is best understood looking at these examples:


Octal System:

Base: 8
Digits: 0, 1, 2, 3, 4, 5, 6, 7
Example: 27 (decimal) = 33 8 (octal)



Hexadecimal (hex) System:

Base: 16
Digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F
Example: 27 (decimal) = 1B 16 (hex)



Binary System:

Base: 2
Digits: 0, 1
Example: 27 (decimal) = 11011 2 (binary)




Transforming Binary, Hex and Octal - Quickly



Binary Hex Binary Octal

0000 0 000 0
0001 1 001 1
0010 2 010 2
0011 3 011 3
0100 4 100 4
0101 5 101 5
0110 6 110 6
0111 7 111 7
1000 8
1001 9
1010 A
1011 B
1100 C
1101 D
1110 E
1111 F





Example

Transform -6F,A 16 into binary number


-6F,A 16  =  -  0110  1111  ,  1010  2  =  - 1101111 , 101 2




Example

Transform 11,000011001 2 into hex number

11,000011001 2   =      11  ,  0000  1100  1  2
= 0011 , 0000 1100 1000 2

= 3 , 0 C 8 16

=
3 , 0C8 16



Example

Transform 37,24 8 into binary number


37,24 8 = 011 111 , 010 100 2 = 11111 , 0101 2




Example

Transform 1111011,10011101 2 into octal number

1111011,10011101 2   =        1  111  011  ,  100  111  01  2
= 001 111 011 , 100 111 010 2

= 1 7 3 , 4 7 2 16

=
173 , 472 16





Technorati Tags:
, , , , , , , , , , ,




6 Responses to “Hex 2 Binary 2 Octal”

  1. Anonymous Randy of PUP 

    Can you give me the exact conversion of binary to decimal, binary to octal, binary to hexadecimal in C Programming.

    Thanx.

    Hope to have it tomorrow.

  2. Anonymous vurdlak 

    You can find them in my sidebar (under "Learn Converting") If you use Internet Explorer, the sidebar could have escaped below this comment box ;(

  3. Anonymous Mohan H N 

    Dear Sir,

    I need subroutine module for Hex to decimal conversion for 8bit data, i need not to display the data i want to access the data. The input i will give from 8 bit reg and the converted data should be

    input will be stored in 8bit reg ------ 0 to FF

    converted data stored in 2, 8bit reg - 0 to 255 hex

    final should be in another 2 8bit reg 0 to 100 decimal

    pls waiting for u r replay

  4. Anonymous karthik balaguru 

    Require some optimised
    'Hexadecimal to binary' conversion C & C++ programs.

    Thx in advans,
    karthik balaguru

  5. Anonymous julius ceasar beltran 

    ei, i cant get what ur teaching is! please be more specific

  6. Anonymous Milan Bhatt 

    Can U give me a code for
    1.Decimal to Binary, Hexa and Octal.
    2.Binary to Hexa, Decimal and Octal
    3.Octal to Bimary, Hexa and Binary
    4.Hexa to Decimal, Octal and Binary

Leave a Reply

      Convert to boldConvert to italicConvert to link

 


German Flag Spanish Flag French Flag Italian Flag Portuguese Flag Japanese Flag Korean Flag Chinese Flag British Flag


This Website is optimized for Firefox. Users browsing with Internet Explorer may encounter problems while viewing pages.


C++ Maniac



Learn C



Additional



#include



Learn Converting



Appendix


Links


Previous posts




Daily Lessons for programming in Visual Studio, using C code.