Number System
Number System
Number System
What is a Number?
A number is a mathematical value used for counting or measuring or labelling objects. Numbers are
used to performing arithmetic calculations. Examples of numbers are natural numbers, whole
numbers, rational and irrational numbers, etc. 0 is also a number that represents a null value.
Number Systems in Computer
The language we use to communicate with each other is comprised of words and characters. We
understand numbers, characters and words. But this type of data is not suitable for computers.
Computers only understand the numbers.
So, when we enter data, the data is converted into electronic pulse. Each pulse is identified as code
and the code is converted into numeric format by ASCII. It gives each number, character and symbol a
numeric value (number) that a computer understands. So to understand the language of computers,
one must be familiar with the number systems.
The Number Systems used in computers are:
o Binary number system
o Octal number system
o Decimal number system
o Hexadecimal number system
The binary number system is very useful in electronic devices and computer systems because it can
be easily performed using just two states ON and OFF i.e. 0 and 1.
Note: We represent any binary number with this format (xxxx)2 and decimal in (xxxx)10 format.
Example 2: Convert (101010)2 = (?)10
We keep on increasing the power of 2 as long as number of digits in binary number increases.
Example 3: Convert (11100)2 = (?)10
1 0 0 0 1
Step-1 First we need to multiply 0 with 2 and add the 1st digit in binary number.
0x2+1=0+1=1
Step-2 Now use the result of above step and multiply with 2 and add the second digit of binary
number.
1 0 0 0 1
1x2+0=2+0=2
The same step 2 is repeated until there will be no digit left. The final result will be the resultant
decimal number.
1 0 0 0 1
2x2+0=4+0=4
1 0 0 0 1
4x2+0=8+0=8
1 0 0 0 1
8 x 2 + 1 = 16 + 1 = 17
So we performed step 2 on all remaining numbers and finally, we left with result 17 which is a
decimal number for the given binary number.
So (10001)2 = (17)10
Example 2: Convert (111)2 to decimal using doubling approach.
1 1 1
0x2+1=0+1=1
1 1 1
1x2+1=2+1=3
1 1 1
3x2+1=6+1=7
The final result is 7 which is a Decimal number for 111 binary numeral system. So (111)2 = (7)10
These are the 2 approaches that can be used or applied to convert binary to decimal.
2. Decimal to Binary Conversion
For converting Decimal numbers into binary numbers, use different methods such as formula,
division methods, and so on. Here, use the remainder formula. Steps to convert decimal number to
binary number using decimal to the binary formula are as follow:
Step 1: Divide the given decimal number by 2, and find the remainder (Ri).
Step 2: Now divide the quotient (Qi) that is obtained in the above step by 2, and find the remainder.
Step 3: Repeat the above steps 1 and 2, until 0 is obtained as a quotient.
Step 4: Write down the remainder in the following manner: the last remainder is written first,
followed by the rest in the reverse order (Rn, R(n – 1) …. R1). Thus binary conversion of the given
decimal number will be obtained.
Let’s understand the above steps with the help of an example.
Example: Convert 17 to Binary Form.
Solution:
Following the above steps we will divide 17 by 2 successively. The division process is shown the
image added below:
Octal number system provides convenient way of converting large binary numbers into more
compact and smaller groups. There are various ways to convert a binary number into octal number.
We can convert using direct methods or indirect methods. First, we need to convert a binary into
other base system (e.g., into decimal, or into hexadecimal). Then we need to convert it octal number.
Since numbers are type of positional number system. That means weight of the positions from right
to left are as 80, 81, 82, 83 and so on for the integer part and weight of the positions from left to right
are as 8-1, 8-2, 8-3and so on for the fractional part.
So, these are following steps to convert a binary number into octal number.
Take binary number
Divide the binary digits into groups of three (starting from right) for integer part and
start from left for fraction part.
Convert each group of three binary digits to one octal digit.
This is simple algorithm where you have to grouped binary number and replace their
equivalent octal digit.
Example-1 − Convert binary number 1010111100 into octal number. Since there is no binary
point here and no fractional part. So,
= (1010111100)2
= (001 010 111 100)2
= (1 2 7 4)8
= (1274)8
Example-2 Convert binary number 0110 011.1011 into octal number. Since there is binary point here
and fractional part. So,
0 000
1 001
2 010
3 011
4 100
5 101
6 110
7 111
This method is simple and also works as reverse of Binary to Octal Conversion. The algorithm
is explained as following below.
Take Octal number as input
Convert each digit of octal into binary.
That will be output as binary number.
Example-1 Convert octal number 540 into binary number.
According to above algorithm, equivalent binary number will be,
= (540)8
= (101 100 000)2
= (101100000)2
This is very simple conversion, you can use for mixed (integer with fractional) octal number as
well.
Example-2 − Convert octal number 352.563 into binary number.
According to above algorithm, equivalent binary number will be,
= (352.563)8
= (011 101 010 . 101 110 011)2
= (011101010.101110011)2
2nd Method
Q.1: Convert 418 to a binary number.
Solution: Given number is 418
418 = (4 * 81) + (1 * 80)
=4*8+1*1
= 32+1
= 33(Decimal number)
Now convert this decimal number into its equivalent binary number. Let us draw a table to show the
conversion of decimal to binary as given below.
33 divided by 2 16 1
16 divided by 2 8 0
8 divided by 2 4 0
4 divided by 2 2 0
2 divided by 2 1 0
1 divided by 2 0 1