# Number Systems | What is a number system in a computer?

We all know that a computer or any other machine can communicate in machine language only. So how come you can type in any language and a computer gives the output in human-readable format?

It means when we enter any data it’s being converted into something which only a computer/machine can understand and then the response from the computer is converted into a human-readable format so that humans can interact with the computer.

In digital systems, instructions are given through electric signals; variation is done by varying the voltage of the signal. Having 10 different voltages to implement a decimal number system in digital equipment is difficult. So, many number systems that are easier to implement digitally have been developed.

## Number System

The Number System in a computer are:

• Binary number system
• Octal number system
• Decimal number system

### Binary number system

It has only two digits ‘0’ and ‘1’ so its base is 2.

In this number system, there are only two types of electronic pulses; the absence of an electronic pulse which represents ‘0’and the presence of an electronic pulse which represents ‘1’. Each digit is called a bit.

A group of four bits (1101) is called a nibble and a group of eight bits (11001010) is called a byte. The position of each digit in a binary number represents a specific power of the base (2) of the number system.

The binary number system is also a positional value system, where each digit has a value expressed in powers of 2.

In any binary number, the rightmost digit is called the least significant bit (LSB) and the leftmost digit is called the most significant bit (MSB).

For example, 10011 represents in the following ways

(1 X 24) + (0 X 23) + (0 X 22) + (1 X 21) + (1 X 20)

16 + 0 + 0 + 2 + 1

19

Computer memory is measured in terms of how many bits it can store. Here is a chart for memory capacity conversion.

• 1 byte (B) = 8 bits
• 1 Kilobytes (KB) = 1024 bytes
• 1 Megabyte (MB) = 1024 KB
• 1 Gigabyte (GB) = 1024 MB
• 1 Terabyte (TB) = 1024 GB
• 1 Exabyte (EB) = 1024 PB
• 1 Zettabyte = 1024 EB
• 1 Yottabyte (YB) = 1024 ZB

### Octal number system

It has eight digits (0, 1, 2, 3, 4, 5, 6, 7) so its base is 8. Each digit in an octal number represents a specific power of its base (8).

As there are only eight digits, three bits (23=8) of a binary number system can convert any octal number into a binary number. This number system is also used to shorten long binary numbers.

The three binary digits can be represented with a single octal digit.

The decimal equivalent of an octal number is the sum of the product of each digit with its positional value.

7268 = 7×82 + 2×81 + 6×80

= 448 + 16 + 6

= 47010

### Decimal number system

The decimal number system has ten digits starting from 0-9 so its base is 10.

The position of each digit in a decimal number represents a specific power of the base (10) of the number system.

For example, let’s say we have three numbers – 734, 971 and 207. The value of 7 in all three numbers is different−

• In 7314, the value of 7 is 7 thousand or 7000 or 7 × 1000 or 7 × 103
• In 9701, the value of 7 is 7 hundred or 700 or 7 × 100 or 7 × 102
• In 2007, value 0f 7 is 7 units or 7 or 7 × 1 or 7 × 100

The weightage of each position can be represented as follows −

In this number system, there are 16 digits that range from 0 to 9 and A to F. So, its base is 16.

The A to F alphabet represents 10 to 15 decimal numbers. The position of each digit in a hexadecimal number represents a specific power of the base (16) of the number system.

As there are only sixteen digits, four bits (24=16) of a binary number system can convert any hexadecimal number into a binary number.

It is also known as an alphanumeric number system as it uses both numeric digits and alphabets.

The decimal equivalent of any hexadecimal number is the sum of the product of each digit with its positional value.

27FB16 = 2×163 + 7×162 + 15×161 + 10×160

= 8192 + 1792 + 240 +10

= 1023410

## Number System Relationship

The following table depicts the relationship between decimal, binary, octal and hexadecimal number systems.

## ASCII(American Standard Code for the Information Interchange)

Besides numerical data, the computer must be able to handle alphabets, punctuation marks, mathematical operators, special symbols, etc. that form the complete character set of the English language. The complete set of characters or symbols is called alphanumeric code. The complete alphanumeric code typically includes −

• 26 upper-case letters
• 26 lowercase letters
• 10 digits
• 7 punctuation marks
• 20 to 40 special characters

Now a computer understands only numeric values, whatever the number system used. So all characters must have a numeric equivalent called the alphanumeric code. The most widely used alphanumeric code is American Standard Code for Information Interchange (ASCII). ASCII is a 7-bit code that has 128 (27) possible codes.

## Standard ASCII Characters

In the ASCII character set, the Decimal values 0 to 31, as well as the Decimal value 127, represent symbols that are non-printable or non-graphical characters.

It is possible to generate these non-printable characters using a key sequence where ^ represents the control key on your keyboard.

For example, you could generate a carriage return (Decimal value 13) by pressing the control key followed by the letter M on your keyboard (^M).

All other symbols in the character set can be printed or represented on the screen and they are known as graphical characters.