# How to be a Programmer | Part 5 : Number Systems

(Number Systems)
Data Representation Methods in the Computer system

## 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.

1. Binary – 0,1
2. Octal – 0,1,2,3,4,5,6,7
3. Decimal – 0,1,2,3,4,5,6,7,8,9

### Binary Number System.

Digits used – 0,1
Base – 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 :- 0110112 , 1101112 , 0101012 , 1101002

### 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,9
Base – 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,7
Base – 8

Ex :- 458 , 1638

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,F
Base – 16

Ex :- 7316 , C3A16

## Conversion

### Decimal to Binary

When a decimal number is converted to a binary number,

Example 2: Converting number 2510 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.

2510 = 110012

Example 1: Converting number 13510 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.

13510 = 100001112

### Decimal to Octal

When a decimal number is converted to a octal number,

Example 1: Converting number 2510 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.

2510 = 318

Example 2: Converting number 13510 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.

13510 = 2078

When a decimal number is converted to a hexadecimal number,

Example 1: Converting number 13510 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.

13510 = 8716

Example 2: Converting number 16310 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.

16310 = 10 316 = A316

### Converting Binary to Decimal

Example 1: Converting number 100112 to a decimal number.

100112 = 1910

Example 2: Converting number 11100012 to a decimal number.

11100012 = 11310

### Converting Octal to Decimal

Example 1: Converting number 128 to a decimal number.

128 = 1010

Example 2: Converting number 4258 to a decimal number.

42518 = 27710

Example 1: Converting number 5016 to a decimal number.

5016 = 8010

Example 2: Converting number A316 to a decimal number.

A316 = 16310

### Converting Binary numbers to octal numbers.

Example 1: Converting number 100010102 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.

100010102 = 1388

Example 2: Converting number 111011000011012 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.

111011000011012 = 354158

### Converting Binary numbers to hexadecimal numbers.

Example 1: Converting number 100010102 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.

100010102 = 8A16

Example 2: Converting number 111100100010102 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.

111100100010102 = 3C8A16

### Converting Octal numbers to Binary numbers.

Example 1: Converting number 1278 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

1278 = 10101112

Example 2: Converting number 10248 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

10248 = 10000101002

### Converting Octal numbers to Hexadecimal numbers.

Example 1: Converting number 10248 to a hexadecimal number.

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

10248 = 001 000 010 1002

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

10248 = 21416

Example 2: Converting number 52748 to a hexadecimal number.

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

52748 = 101 010 111 1002

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

52748 = 10 11 1216 = ABC16

### Converting Hexadecimal numbers to Binary numbers.

Example 1: Converting number 29416 to a binary number.

19516 = 1010101111002

Example 2: Converting number A2D16 to a binary number.

A2D16 = 1010001011012

### Converting Hexadecimal numbers to Octal numbers.

Example 1: Converting number 127816 to a binary number.

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

127816 = 001 001 001 111 0002

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

127816 = 111708

Example 2: Converting number AC216 to a binary number.

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

AC2016 = 001 010 110 000 100 0002

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

AC2016 = 1260408

## Number Systems – Complete Table

### 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.