Number System Complete Tutorial (Computers) | Types | Conversions | Examples

# Number System Complete Tutorial (Computers) | Types | Conversions | Examples

In this post, learn about Number System in Computers, their types, examples and most importantly the conversion of numbers in of various types.

## Number System

A number system is a writing system is a collection of various symbols which are called digits. Computers don’t understand high level languages like us. They can only understand numbers (mostly binary numbers).

### Types of Number System

There are various types of Number Systems but here we will be discussing about the most common types of Number systems.

#### Binary Number System

• Base 2 (2 Digits: 0 and 1)
• This system is a positional notation with a radix of 2. Each digit is referred to as a bit.
• Because of its straightforward implementation in digital electronic circuitry using logic gates, the binary system is used by almost all modern computers and computer-based devices.

#### Decimal Number System (Hindu–Arabic Numeral System)

• Base 10 (10 Digits: 0 to 9)
• Occasionally called denary.
• Standard system for denoting integer and non-integer numbers.

#### Octal Number System

• Base 8 (8 Digits: 0 to 7)

• Base 16 (10 Digits & 6 Characters: 0 to 9 and A to F)

## Conversion of Numbers in Various Number Systems

### A. Binary to Other Number Systems

#### 1. Binary To Octal Conversion

(11101010)2 = (352)8

Step 1: Write down the binary number

`(011101010)2`

Group all the digits in sets of three starting from the LSB (far right). Add zeros to the left of the last digit if there aren’t enough digits to make a set of three.

`011 101 010`

Step 2: Use the table below to convert each set of three into an octal digit. In this case,

`011=3, 101=5, 010=2`

So, the number 11101010 in binary is equivalent to 352 in octal.

To convert from binary to octal use the following table:

 Binary: Octal: 000 001 010 011 100 101 110 111 0 1 2 3 4 5 6 7

#### 2. Binary To Decimal Conversion

(11101010)2 = (234)10

Step 1: Write down the binary number

`11101010`

Step 2: Multiply each digit of the binary number by the corresponding power of two

```1x27 + 1x26 + 1x25 + 0x24 + 1x23 + 0x22 + 1x21 + 0x20
```

Step 3: Solve the powers

```1x128 + 1x64 + 1x32 + 0x16 + 1x8 + 0x4 + 1x2 + 0x1 = 128 + 64 + 32 + 0 + 8 + 0 + 2 + 0
```

Step 4: Add up the numbers written above

```128 + 64 + 32 + 0 + 8 + 0 + 2 + 0 = 234.
```

Thus 234 is the decimal equivalent of the binary number 11101010

#### 3. Binary To Hexadecimal Conversion

(11101010)2 = (EA)16

Step 1: Write down the binary number

`11101010`

Step 2: Group all the digits in sets of four starting from the LSB (far right). Add zeros to the left of the last digit if there aren’t enough digits to make a set of four:

`1110 1010`

Step 3: Use the table below to convert each set of three into an hexadecimal digit, in this case:

`1110 = E, 1010 = A`

So, EA is is the hexadecimal equivalent to the decimal number 11101010.

To convert from binary to hexadecimal use the following table:

 Binary: Hexadecimal: Binary: Hexadecimal: 0000 0001 0010 0011 0100 0101 0110 0111 0 1 2 3 4 5 6 7 1000 1001 1010 1011 1100 1101 1110 1111 8 9 A B C D E F

### B. Decimal To Other Number Systems

#### 1. Decimal To Binary Conversion

(123)10 = (1111011)2

Step 1: Divide (123)10 successively by 2 until the quotient is 0

``` 123/2 = 61, remainder is 1
61/2 = 30, remainder is 1
30/2 = 15, remainder is 0
15/2 =  7, remainder is 1
7/2 =  3, remainder is 1
3/2 =  1, remainder is 1
1/2 =  0, remainder is 1
```

Step 2: Read from the bottom (MSB) to top (LSB) as 1111011. This is the binary equivalent of decimal number 123.

#### 2. Decimal To Octal Conversion

(123)10 = (173)8

Step 1: Divide (123)10 successively by 8 until the quotient is 0:

``` 123/8 = 15, remainder is 3
15/8 =  1, remainder is 7
1/8 =  0, remainder is 1
```

Step 2: Read from the bottom (MSB) to top (LSB) as 173. This is the octal equivalent of decimal number 123

#### 3. Decimal To Hexadecimal Conversion

(123)10 = (7B)16

Step 1: Divide (123)10 successively by 16 until the quotient is 0:

```123/16 = 7, remainder is 11

7/16 = 0, remainder is 7
```

Here is the table for conversion Decimal to Hexa and Vice-Versa

 Dec: Hex: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 0 1 2 3 4 5 6 7 8 9 A B C D E F

Step 2: Read from the bottom (MSB) to top (LSB) as 7B. This is the hexadecimal equivalent of decimal number 123

### B. Octal To Other Number Systems

#### 1. Octal To Binary Conversion

(123)8 = (1010011)2

Step 1: Look up each octal digit to obtain the equivalent group of three binary digits.

```(1)8 = (001)2
(2)8 = (010)2
(3)8 = (011)2
```

You can use the table below to make these conversions.

 Oct: Bin: 0 1 2 3 4 5 6 7 000 001 010 011 100 101 110 111

Group each value of step 1 to make a binary number:

```001 010 011
```

So, (1010011)2 is the binary equivalent to (123)8