Number System in Computers | BCA | SparkEasy

 Number System in Computers 

 

👉As we all know, every computer is designed to store information such as – numbers, letters, and other special characters in coded form. So, here comes the need to have a basic understanding of the Number System in Computers.

So, there are two types of Number systems – positional and non-positional. At first, we will discuss what a non-positional number system is? Later on, we will talk about the positional number system in computers.

 

Non-positional Number systems

 

In a non-positional number system, each symbol represents the same value regardless of its position in the number. To find the value of a number, one has to count the number of symbols present in the number. It is tough to perform arithmetic with such a number system. This system has symbols such as I for 1, II for 2, III for 3, IIII for 4, IIIII for 5, etc.

 

Positional Number systems

 

In a positional number system, there are only a few symbols called digits. These symbols represent different values depending on their position in a number. Three considerations determine the value of each digit in such a number:-

(i) the digit itself

(ii) the position of the digit in the number

(iii) the base of the number system

Note:- Base is the total number of digits available in the number system.

 

 Download PDF: Hindi 100 Marks Book for BCA/BA/B.Com/B.Sc.

 

In the computer positional number systems, we generally discuss four number systems. i.e., Binary, Octal, Decimal, and Hexadecimal Numbers. Here, Table 1.1 shows the relationship among all the four number systems in computers.

 

Decimal

Hexadecimal

Binary

Octal

0

0

0

0

1

1

1

1

2

2

10

2

3

3

11

3

4

4

100

4

5

5

101

5

6

6

110

6

7

7

111

7

8

8

1000

10

9

9

1001

11

10

A

1010

12

11

B

1011

13

12

C

1100

14

13

D

1101

15

14

E

1110

16

15

F

1111

17

16

10

10000

20

 

Binary Number System

 

In the binary number system, the value of the base is 2. Hence, it has only two digits (0 and 1). Each position in a binary number represents the base’s power (2). Hence in this system, the rightmost position is the units (20), the second position from the right is 2’s (21), and so on.

Therefore, the decimal equivalent of the binary number 10112 is:-

(1x23) + (0x22) + (1x21) + (1x20) = 8+0+2+1 = 11

Note:- To be specific about which system we are referring to, it is common practice to indicate the base as a subscript. Hence, we write:

10112 = 1110 

A bit is a short form of “binary digit.” Hence, a “bit” in computer terminology means a 0 or 1. An n-bit number is a binary number consisting of ‘n’ bits. Table 1.2 given below lists all 3-bit numbers along with their decimal equivalent.

 

Binary

Decimal

000

0

001

1

010

2

011

3

100

4

101

5

110

6

111

7

 

In binary number systems, with 3 bits, only eight different patterns of 0s and 1s are possible. Furthermore, a 3-bit number can have one of the eight values from 0 to 7. Any decimal number in the range 0 to 2n-1 can be represented as an n-bit number in binary form.

 

Decimal Number system

 

As we have seen, in the decimal number system, the base is equal to 10, and the digits range from 0 to 9. Each position in a decimal number represents the base’s power (10). Hence in this system, the rightmost position is the units (100), the second position from the right is the (101), and so on.

For example, the decimal number 303210 can be written as:-

(3×103)+(0x102)+(3x101)+(2x100) = 3000+0+30+2 = 3032

 

Octal Number System

 

In the octal number system, the octal number system base is equal to 8, and the digits range from 0 to 7. Each position in an octal number represents the base’s power (8). Hence in this system, the rightmost position is the unit (80), the second position from the right is the (81), and so on.

Therefore, the decimal equivalent of the octal number 20428 is:-

(2×83) + (0x82) + (4×81) + (2×80) = 1024+0+32+2 = 1058

Hence, 20428 = 105810 

Note:- Since there are only eight digits in the octal number system, 3 bits (23=8) are sufficient to represent any octal number in binary (see Table 1.2).

 

Hexadecimal Number System

 

In the hexadecimal number system, the base is 16. Hence, there are 16 digits. The first ten digits are the same digits of a decimal number system (0 to 9). The remaining six digits are the symbols A, B, C, D, E, and F, representing decimal values 10, 11, 12, 13, 14, and 15, respectively.

Each position in a hexadecimal number represents the base’s power (16). Hence in this system, the rightmost position is the unit (160), the second position from the right is the (161), and so on.

Therefore, the decimal equivalent of the hexadecimal number 1AC16 is:-

(1×162) + (Ax161) + (Cx160) = (1×256)+(10×16)+(12×1) = 256+160+12 = 428

Hence, 1AC16 = 42810 

Note:- Since there are only 16 digits in the hexadecimal number system, 4 bits (24=16) are sufficient to represent any hexadecimal number in binary (see Table 1.1).

 

Converting from one Number System to Another

 

Input data fed to computers and final output values are decimal because decimal numbers are much more meaningful to us than any other number system. Hence, computer professionals often must convert numbers in other number systems to decimal and vice-versa.

 

1. Conversion: Another Base to Decimal

 

Example 1.1. 111012 = ?10

11101= (1x24+ (1x23) + (1x22) + (0x21) + (1x20)

           = 1×16 + 1×8 + 1×4 + 0x2 + 1×1

           = 16 + 8 + 4 + 0 + 1

           = 2910

 
Example 1.2. 3428 = ?10

 

342= (3x82) + (4x81) + (2x80)

         = 3×64 + 4×8 + 2×1 

         = 192 + 32 + 2

         = 22610

 

Example 1.3. 2BA16 = ?10

 

2BA16 (2x162) + (Bx161) + (Ax160)

           = 2×256 + 11×16 + 10×1 

           = 512 + 176 + 10

           = 69810

 

Example 1.4. 30126 = ?10

 

3012= (3x63) + (0x62) + (1x61) + (2x60)

           = 3×216 + 0x36 + 1×6 + 2×1 

           = 648 + 0 + 6 + 2

           = 65610

 

2. Conversion: Decimal to Another Base

 

3. Conversion: Binary to Octal

 
binary-to-octal
 

4. Find the decimal equivalent of the binary number 101.111?

 
101.111= (1x22) + (0x21) + (1x20) + (1x2-1) + (1x2-2) + (1x2-3)

             = 4 + 0 + 1 + 0.5 + 0.25 + 0.125

             = 5.87510

5. Find the decimal equivalent of the hexadecimal number 2A.B4?
 
2A.B416 (2x161) + (Ax160) (Bx16-1) + (4x16-2)

              = 32 + 10 + 11/16 + 4/256

              = 32 + 10 + 0.6875 + 0.015625

              = 42.70312510

Also Read:)

 

Leave a Comment