**(Number Systems)Data Representation Methods in the Computer system**

**Read First: **

- How to be a Programmer | Part 1 : Introduction
- How to be a Programmer | Part 2 : Top 20 Programming Languages
- How to be a Programmer | Part 3 : Basic Concept of Programming
- How to be a Programmer | Part 4 : Control Structures

**What is Number Systems?**

The number systems used for the representation of data in the computer. When typing letters using a computer, these words are represented by the computer as the number it can understand. While this group of numbers that computer can understand called a ‘Number System’ the limited number of numerals in the number systems called digits. there are mainly four types of number systems.

- Binary – 0,1
- Octal – 0,1,2,3,4,5,6,7
- Decimal – 0,1,2,3,4,5,6,7,8,9
- Hexadecimal – 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F

**Binary Number System.**

**Digits used – 0,1Base – 2**

Computer represents data in two signal states. These are two Voltage levels for these two symbols. One is named as the high voltage level (1 – ON) and the other is named as a low voltage level. (0 – OFF)

*Ex :- 011011*_{2}* , 110111*_{2}* , 010101*_{2 , }*110100*_{2 }

**Decimal Number System.**

It is the standard system for denoting integers and non-integers.

**Digits used – 0,1,2,3,4,5,6,7,8,9Base – 10**

*Ex :- 103, 117,*

**Octal Number System.**

It is the standard system for denoting integers and non-integers.

**Digits used – 0,1,2,3,4,5,6,7Base – 8**

*Ex :- 45*_{8}* , 163*_{8}* *

**Hexadecimal Number System.**

The computer uses binary numbers and it’s difficult for human beings to read them. So, the hexadecimal number system is used as it is easier for humans to use.

**Digits used – 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,FBase – 16**

*Ex :- 73*_{16}* , C3A*_{16}

**Conversion**

**Decimal to Binary**

When a decimal number is converted to a binary number,

*Example 2: Converting number 25*_{10}* to a binary number. *

The decimal numbers can be divided by 2 until the remainder is 0 and the remainder of the division can be written on the right side. After that, write all the remainders from the bottom to top to build the binary number.

**25**_{10}** = 11001**_{2}

*Example 1: Converting number 135*_{10}* to a binary number.*

The decimal numbers can be divided by 2 until the remainder is 0 and the remainder of the division can be written on the right side. After that, write all the remainders from the bottom to top to build the binary number.

**135**_{10}** = 10000111**_{2}

**Decimal to Octal**

When a decimal number is converted to a octal number,

**Example 1:***Converting number 25*_{10}* to an Octal number.*

The decimal numbers can be divided by 8 until the remainder is 0 and the remainder of the division can be written on the right side. After that, write all the remainders from the bottom to top to build the octal number.

**25**_{10}** = 31**_{8}

**Example 2:***Converting number 135*_{10}* to an octal number.*

the decimal numbers can be divided by 8 until the remainder is 0 and the remainder of the division can be written on the right side. After that, write all the remainders from the bottom to top to build the octal number.

**135**_{10}** = 207**_{8}

**Decimal to Hexadecimal**

When a decimal number is converted to a hexadecimal number,

*Example 1: Converting number 135*_{10}* to a hexadecimal number. *

the decimal numbers can be divided by 16 until the remainder is 0 and the remainder of the division can be written on the right side. After that, write all the remainders from the bottom to top to build the hexadecimal number.

**135**_{10}** = 87**_{16}

*Example 2:**Converting number 163*_{10}* to a hexadecimal number.*

the decimal numbers can be divided by 16 until the remainder is 0 and the remainder of the division can be written on the right side. After that, write all the remainders from the bottom to top to build the hexadecimal number.

**163**_{10}** = 10**_{ }**3**_{16 = }** A3**_{16}** **

**Converting Binary to Decimal**

*Example 1: Converting number 10011*_{2}* to a decimal number.*

**10011**_{2}** = 19**_{10}** **

*Example 2: Converting number 1110001*_{2}* to a decimal number.*

**1110001**_{2}** = 113**_{10}

**Converting Octal to Decimal**

*Example 1: Converting number 12 _{8} to a decimal number.*

**12**_{8}** = 10**_{10}

*Example 2: Converting number 425 _{8} to a decimal number.*

**425**_{18}** = 277**_{10}

**Converting Hexadecimal to Decimal**

**Example 1:**** ****Converting number 50**_{16}** to a decimal number.**** **

**50**_{16}** = 80**_{10}

**Example 2: Converting number A3**_{16}** to a decimal number.**

**A3**_{16}** = 163**_{10}

**Converting Binary numbers to octal numbers.**

**Example 1: Converting number 10001010**_{2}** to an octal number.**

First, split the number into 3 bits from the right to the left. If the last batch in the left corner does not consist of 3 bits, add 0s to complete. Write each octal number separately for each batch. Then write these batches in octal digits.

Write these digits in order from the left to the right and write down the base.

**10001010**_{2}** = 138**_{8}

*Example 2: Converting number 11101100001101*_{2}* to an octal number. *

First, split the number into 3 bits from the right to the left. If the last batch in the left corner does not consist of 3 bits, add 0s to complete. Write each octal number separately for each batch. Then write these batches in octal digits.

Write these digits in order from the left corner to the right corner and write down the base.

**11101100001101**_{2}** = 35415**_{8}

**Converting Binary numbers to hexadecimal numbers.**

Decimal | Hexadecimal | Binary |

0 | 0 | 0000 |

1 | 1 | 0001 |

2 | 2 | 0010 |

3 | 3 | 0011 |

4 | 4 | 0100 |

5 | 5 | 0101 |

6 | 5 | 0110 |

7 | 7 | 0111 |

8 | 8 | 1000 |

9 | 9 | 1001 |

10 | A | 1010 |

11 | B | 1011 |

12 | C | 1100 |

13 | D | 1101 |

14 | E | 1110 |

15 | F | 1111 |

** Example 1: Converting number 10001010**_{2}** to an hexadecimal number. **

First, split the number into 4 bits from the right corner to the left. If the last batch in the left corner does not consist of 4 bits, add 0s to complete. Write each hexadecimal number separately for each batch. Then write these batches in hexadecimal digits.

Write these digits in order from the left corner to the right corner and write down the base.

** 10001010**_{2}** = 8A**_{16}** **

* Example 2: Converting number 11110010001010*_{2}* to an hexadecimal number. *

First, split the number into 4 bits from the right corner to the left. If the last batch in the left corner does not consist of 4 bits, add 0s to complete. Write each hexadecimal number separately for each batch. Then write these batches in hexadecimal digits.

Write these digits in order from the left corner to the right corner and write down the base.

** 11110010001010**_{2}** = 3C8A**_{16}** **

**Converting Octal numbers to Binary numbers.**

*Example 1: Converting number 127*_{8}* to a binary number. *

Firstly, write each digits in octal number in 3 bits. Then, write down all the bits together to get the binary number

**127**_{8}** = 1010111**_{2}

*Example 2: Converting number 1024*_{8}* to a binary number.*

Firstly, write each digits in octal number in 3 bits. Then, write down all the bits together to get the binary number

**1024**_{8}** = 1000010100**_{2}

**Converting Octal numbers to Hexadecimal numbers.**

*Example 1: Converting number 1024*_{8}* to a hexadecimal number. *

Firstly, write each digit in octal number in 3 bits. (Convert octal number to binary number)

**1024**_{8}** = 001 000 010 100**_{2}

Split the binary number into 4-bit batches from the right corner to the left corner. Write the related hexadecimal number for each batch

**1024**_{8}** = 214**_{16}

*Example 2: Converting number 5274*_{8}* to a hexadecimal number. *

Firstly, write each digit in octal number in 3 bits. (Convert octal number to binary number)

**5274**_{8}** = 101 010 111 100**_{2}

Split the binary number into 4-bit batches from the right corner to the left corner. Write the related hexadecimal number for each batch.

**5274**_{8}** = 10 11 12**_{16}** = ABC**_{16}** **

**Converting Hexadecimal numbers to Binary numbers.**

*Example 1: Converting number 294*_{16}* to a binary number.*

**195**_{16}** = 101010111100**_{2}

*Example 2: Converting number A2D*_{16}* to a binary number.*

**A2D**_{16}** = 101000101101**_{2}

**Converting Hexadecimal numbers to Octal numbers.**

*Example 1: Converting number 1278*_{16}* to a binary number.*

Firstly, write each digit in hexadecimal numbers in 4 bits. (Convert hexadecimal number to binary number)

**1278**_{16}** = 001 001 001 111 000**_{2}

Split the binary number into 3-bit batches from the right corner to the left corner. Write the related octal number for each batch

**1278**_{16}** = 11170**_{8}

*Example 2: Converting number AC2*_{16}* to a binary number.*

Firstly, write each digit in hexadecimal numbers in 4 bits. (Convert hexadecimal number to binary number)

**AC20**_{16}** = 001 010 110 000 100 000**_{2}

Split the binary number into 3-bit batches from the right corner to the left corner. Write the related octal number for each batch

**AC20**_{16}** = 126040**_{8}

**Number Systems – Complete Table**

Decimal | Binary | Octal | Hexadecimal |

0 | 0000 | 0 | 0 |

1 | 0001 | 1 | 1 |

2 | 0010 | 2 | 2 |

3 | 0011 | 3 | 3 |

4 | 0100 | 4 | 4 |

5 | 0101 | 5 | 5 |

6 | 0110 | 6 | 6 |

7 | 0111 | 7 | 7 |

8 | 1000 | 8 | |

9 | 1001 | 9 | |

10 | 1010 | A | |

11 | 1011 | B | |

12 | 1100 | C | |

13 | 1101 | D | |

14 | 1110 | E | |

15 | 1111 | F |

### Hi Buddies,

Hope this post (How to be a Programmer Part 5 – Number Systems) will help you to learn something, If you enjoy my work then please **share **my posts with your friends and anyone who might be interested in programming and don’t forget to **subscribe** my mailing list.

If you had any problem with this post, please do mention it in the **comment **section.

Like ctechf Facebook fan page : https://www.facebook.com/ctechf

Also Read :

- How to be a Programmer | Part 1 : Introduction
- How to be a Programmer | Part 2 : Top 20 Programming Languages
- How to be a Programmer | Part 3 : Basic Concept of Programming
- How to be a Programmer | Part 4 : Control Structures
- HTML Tutorial | Introduction for Beginners
- How to install Ubuntu on Windows 10
- JavaSctipt Tutorial | Introduction for Beginners
- Python Tutorial | Introduction for Beginners.
- Python Tutorial | Introduction for Beginners (Part 2).

Sources :

https://pixabay.com/ (images)

ICT Books (Details)

https://www.draw.io (Charts)