# Number System | Conversion | Types | Explanation

Where is human being used decimal arithmetic, but the computer system use binary System. Therefore we need **Number system**. In this article we are going to explain how to convert decimal system to the Binary System and vice versa so that we can translate our thought to the computer system and computer language to our language. The convenient representation of binary numbers called as hexadecimal

Binary number system we use in coding fro Arduino project and other microcontroller projects

The binary format of the alpha numeric code known as ASCII

Table of Contents

## Decimal and binary number system

The origin of the decimal system is the fact that the human being have 10 fingers also there is no idea about the use of Binary System in computers the Binary System is used to in computer because all we know the voltage is in the form of zero or one it means that the signal is digital zero or one so computer and coding always recognise zero or one

In the next paragraph we will learn how to convert a decimal to binary

### Convert Number system from decimal to binary

One method of converting from disable to binary is to divide the decimal number buy 3 repeatedly. Keeping track of the reminders. This process continuous until the quotient become zero. To obtain the binary number we have to write the remainder in reverse order.

For example:- Convert 25d to binary.

Solution | Quotient | Reminder |
---|---|---|

25/2 | 12 | 1 LSB (least significant bit) |

12/2 | 6 | 0 |

6/2 | 3 | 0 |

3/2 | 1 | 1 |

1/2 | 0 | 1 MSB (most significant bit) |

Therefore, 25 decimal convert to binary 11001

### Convert binary to decimal

To convert from binary to decimal it is important to understand the concept of weight associated with each digit position. First recall the weight of the number in the decimal system as shown in the table each digit position of a number in binary has a weight associated with it

For example

110101 binary =?

2 | decimal | Binary | |||
---|---|---|---|---|---|

1 x 2 ^0 | = | 1 x 1 | = | 1 | 1 |

0 x 2 ^1 | = | 0 x 2 | = | 0 | 00 |

1 x 2 ^2 | = | 1 x 2 x2 | = | 4 | 100 |

0 x 2^3 | = | 0 x 2 x 2 x 2 | = | 0 | 0000 |

1 x 2^4 | = | 1x2x2x2x2 | = | 16 | 10000 |

1×2^5 | = | 1x2x2x2x2x2 | = | 32 | 100000 |

53 | 1 1 01 01 |

Knowing the weight of each bit the binary number make it simple to add them together to get its that civil equivalent.

## Hexadecimal number system

The hexadecimal system also known as the computer literature and also we know it the name of base 16 the Elsa decimal number system is used as a convenient representation of binary numbers for example. If there is a number 100100110 it is easy to represent it in a hexadecimal equivalent which is 896h the Binary System has only two digits zero and one the decimal system has 10 digit 029 the headset decimal system has 16 digit.

The first 10 digits are same as in decimal and for the remaining digit the letters ABCDEF are used given table show the equivalent binary, decimal and hexadecimal representation of 0 to 15 numbers

## Number System Table

Decimal | Binary | Hexadecimal |
---|---|---|

0 | 0000 | 0 |

1 | 0001 | 1 |

2 | 0010 | 2 |

3 | 0011 | 3 |

4 | 0100 | 4 |

5 | 1010 | 5 |

6 | 0110 | 6 |

7 | 0111 | 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 |

### Convert binary and hex

To represent a binary number as its equivalent hexadecimal number start from the right and group 4 bits at a time replacing each 4 bit binary number with its X equivalent shown in table to convert from hex to binary each hex digit is replaced with its four bits binary equivalent.

For example, represent binary 100111110101

First make groups of each 4 numbers. into sets of 4 bits like **1001 1111 0101**

then each group of 4 bits replaced by it’s hex equivalent as given in the table

1001 =9

1111 = F

0101 = 5

Therefore, 100111110101 = 9F5 Hexadecimal

Now’ it’s turn to decimal from hex.

### Convert From decimal to hex

There is two ways to approach for converting from decimal to hexadecimal and we are explaining both the ways.

First method is convert to binary first and then convert to hex

And the second method is you can convert directly to heads. This method can be done by repeated division of the reminders experimental this method that to The Reader next example:-

Convert 45 Decimal to hex

32 | 16 | 8 | 4 | 2 | 1 |

1 | 0 | 1 | 1 | 0 | 1 |

First Convert to binary

32+8+4+2+1 =45

45 Dec = 0010 1101 = 2 D Hex

Here 4 = 0010 according to thee given table

5= 1101

and in hex 0010 =2

& 1101 = D

Final, 2D Hex.

This was the 1st method in which we are converting the Decimal to hexadecimal.

In this method we need to convert the system to the binary first then easily we can convert it to the Hexadecimal.

Another Example:-

Convert 629 decimal to hex

512 | 256 | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |

1 | 0 | 0 | 1 | 1 | 1 | 0 | 1 | 0 | 1 |

629(10) = (512+64+32+16+8+4+2+1)= 0010 0111 0101 = 275

### Convert from Hex to Decimal

There is two way to convert has to decimal when you will explain both the ways payment we did in the previous conversion.

Convert from has to binary and then two decimal first of all we have to convert our hex value to the binary and then we can easily convert this binary to the decimal.

Convert directly, convert directly from heads to decimal by suming the weight of all the digits you can convert text to decimal by using the both method as we have done in the previous conversion.

Example

6B2 = 0110 1011 0010

1024 | 512 | 256 | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |

1 | 1 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 1 | 0 |

1024+512+128+32+16+2 = 1714

## Counting in binary decimal hexadecimal

To show the relationship between all three bases we are making a table which will show the sequence of number from 0 to 31 in decimal along with the equivalent binary and the decimal number.

From where you can see the relationship between decimal binary hexadecimal so all are will be given in equivalent in this table no more is added to the highest digit the digit become zero and A1 is carry to the next highest digit for example.

### Counting in Number system

Decimal | Binary | Hexadecimal |
---|---|---|

0 | 00000 | 0 |

1 | 00001 | 1 |

2 | 00010 | 2 |

3 | 00011 | 3 |

4 | 00100 | 4 |

5 | 00101 | 5 |

6 | 00110 | 6 |

7 | 00111 | 7 |

8 | 01000 | 8 |

9 | 01001 | 9 |

10 | 01010 | A |

11 | 01011 | B |

12 | 01100 | C |

13 | 01101 | D |

14 | 01110 | E |

15 | 01111 | F |

16 | 10000 | 10 |

17 | 10001 | 11 |

18 | 10010 | 12 |

19 | 10011 | 13 |

20 | 10100 | 14 |

21 | 10101 | 15 |

22 | 10110 | 16 |

23 | 10111 | 17 |

24 | 11000 | 18 |

25 | 11001 | 19 |

26 | 11010 | 1A |

27 | 11011 | 1B |

28 | 11100 | 1C |

29 | 11101 | 1D |

30 | 11110 | 1E |

31 | 11111 | 1F |

## Addition of Number System & Subtraction of Number system,

### binary and hexadecimal number

The addition of binary number is very easy and straight forward process which is very simple to understand and where giving an example to so you can easily understand the edition of binary decimal number.

Given in the table the addition of two bits the discussion of subtraction of binary number is bypass since all computer use the addition process to implement subtraction.

It is very different that there is no subtractor circuitry inside the computer all the subtraction of the number system is occurred in the adder so they always use the not component to make the subtraction so we are making a table in which planning how to add binary and has the decimal number.

A+B | Carry | Sum |
---|---|---|

0 + 0 | 0 | 0 |

0 + 1 | 0 | 1 |

1 + 0 | 0 | 1 |

1 + 1 | 1 | 0 |

For Example:-

Binary | Decimal |
---|---|

1101 | 13 |

+1001 | 9 |

10110 | 22 |

## The 2’s Compliment

The 2’s of a binary number in word all the bits and then add one to the result it is the 2’S complement. In the number system the 2S complement of a binary number is very important inverting the bit is simply a matter of changing all 0 to 1 and 1 to 0.

for example

Take the 2’s compliment of 10011101

10011101 Binary number | |

+ 01100010 1’s compliments | |

1 | |

01100011 2’s compliment |

### Addition and Subtraction of Hex Numbers in Number system

Studying issues related to Software and Hardware of computers. you must know the addition and substraction of hexadecimal number. as we have discussed the hexadecimal number system, is used by the computers.

#### Addition of Hex Number

We are going to describe the process of adding hacks number in a simple way so we are going to start the list significant digit that digits at added together if the result is less than 16 right that digit as the sum for that position. It is greater than 16 subtract 16 from it to get the digit and carry one to the next digit. Best way to explain this is by the example

perform hex addition 23D9 +94BE

23D9

+ 94D9

B897

LSD:- 9+14 =23, 23-16 =7 with a carry

1+13+11 =25. 25-16 = 9 with a carry

1+3+4 = 8

MSD 2 + 9 =B

#### Subtraction of Hex Numbers

in subtracting in two hexadecimal numbers, if the second digit is greater than the first digit. borrow 16 from the proceeding digit.

For example:-

59F-2B8

59F LSD 8 from 15 = 7

–2B8. 11 from 25(9+16)= 14(E)

2E7. 2 from 4 (5-1) = 2

## FAQ’s for Number System

1. What is a number system?

A number system is a way of expressing numbers using symbols or digits. It provides a systematic way to represent and manipulate numerical values.

2. How many types of number systems are there?

There are several types of number systems, including decimal (base-10), binary (base-2), octal (base-8), and hexadecimal (base-16). Each system has its unique way of representing numbers.

3. What is the decimal number system?

The decimal number system is the most common and widely used system, using base-10 with digits 0 to 9. It is the system we use in our day-to-day life for counting and arithmetic operations.

4. What is the binary number system?

The binary number system uses base-2 and consists of only two digits: 0 and 1. It is fundamental in computer science and digital electronics, representing information using bits.

5. How do you convert numbers between different bases?

To convert a number from one base to another, you can use different methods. For example, converting from binary to decimal involves multiplying each digit by 2 raised to the power of its position.

6. Why is hexadecimal used in computing?

Hexadecimal, base-16, is commonly used in computing because it provides a concise way to represent large binary numbers. It is easier for humans to read and understand, and each digit corresponds to four binary digits.

Also, we are giving here a full detail number system pdf