Pratham AI Systems

In this article, I will discuss how, Number systems will be used in a computer systems and how to convert decimal to binary and binary to decimal number. It will also discuss applications of Number systems in computer. The knowledge of number system helps in develop hardware programming (i.e. for developing device drivers), operating system programs, to understand bitwise operators in high level languages and to crack coding problems and interviews.

Programming improves: Logical thinking, creativity and problem solving

Number systems

Number systems are the technique to represent numerical values (numbers) in the computer system.

There are four types of number systems.

  • Decimal Number System
  • Binary Number System
  • Octal Number System
  • Hexadecimal Number System

Decimal Number System  [ DNS]  :- Deci means 10 so DNS consist of ten digits from 0 – 9. A decimal number system is any combination of digits from 0 to 9.

0,1,2,3,4,5,6,7,8,9,

10,11,………

                        Example:   178, 234, 908, -99876

Octal Number System [ ONS] :- Octal means 8 so ONS consist of 8 digits from 0 -7. An octal number system is any combination of digits from 0 to 7.

0,1,2,3,4,5,6,7,10,11,12,13,14,15,16,17,20,21,22,23,24,25,26,27,30,31 and so on.

Note: In ONS 8 and 9 cannot be used.

                        Example:     76, 75, 11, 0123

Binary Number System [BNS] :- Bi means 2 so BNS  consist of 2 digits 0 –1. A binary number system is any combination of digits 0 and 1.

0,1,10,11,100,101,110,111,1000,1001,……..

Note: In BNS only 0 and 1 can be used.

            Example:       01, 00, 11, 100010001, 11001100, 11110000

Hexadecimal Number System [HNS]:– Hexa means 6 and deci means 10 so HNS consist of 16 characters. 0 –9 digits and A-F characters.

Where A=10, B=11, C=12, D=13, E=14, F=15

0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F,10,11,12,13,14,15,16,17,18,19,1A,1B,1C,1D,1E,1F,20,21,22,23,24,25,26,27,28,29, 2A,2B,2C,2D,2E,2F,30,31,……and so on

Note: HDNS can consists of characters A,B,C,D,E,F and number 10 will come after F.

Example       76, 11, 01, 2A, 2FBC, AB12C

Conversion of Number System

We can convert one number system into another number system according to our requirements. Decimal number system can be converted to binary, octal, hexadecimal number system. Likewise any number system can be converted to any other number system. In this article we will only convert decimal to binary and binary to decimal because conversion of other number systems will not required in computer system.

8-4-2-1 representation in digital

Conversion of  DNS to BNS :-

Example:

Convert 81 decimal to binary.

Arrange the numbers according to weights as given below. Put the digit 1 below the number 81 or less than 81. 64 is the number less than 81 so put 1 below 64 and subtract 64 from 81 we get 17. Put the digit 1 below the number 17 or less than 17. 16 is the number less than 17 so put 1 below 16 and subtract 16 from 17 we get 1. Now put the 1 below 1 and subtract 1 from 1 we get 0. Put zeros below other numbers. Now stop the process we get

 (01010001) is the binary equivalent of 81.

           

128      64        32        16        8          4          2          1

 0         1          0          1         0          0         0         1

Conversion of BNS to DNS:-

Example:

Convert (10011011)  to decimal.

Arrange the numbers according to 8-4-2-1 representation as given below. Put the digits 1 and 0 below the number according to the positions of the digits. Add all 1’s bit we get 155.     

128      64        32        16        8          4          2          1

 1          0          0          1         1          0          1          1

(10011011)     binary is 155 decimal.

Applications of number systems

Applications of binary number systems

  1. To represent machine code: Programs are normally written in High level language such as C/C++/ Java. Computer only understands machine or binary or low level language which is actually binary representation of High level language programs in binary.
  2. Internal operations of instructions and processing: For execution of instruction computer uses binary language which is written in binary.
  3. Storage: For storing data temporarily in RAM and permanently in secondary storage devices.

Applications of Octal number systems

  1. To represent interrupt request
  2. Some commands like chmod in Linux/ Unix uses octal number system to represents owner, group and others file permissions.

Applications of decimal number systems

  1. To represent financial data
  2. To represent IP addresses in IPV4
  3. To represent ASCII (American Standard Code for Information Interchange) code in computers and some electronic devices.

 Applications of hexadecimal number systems

  1. To represent memory addresses
  2. To represent devices connected to computer system
  3. To represent IP addresses in IPV6
  4. To represent Unicode (Universal code) in computer system to represents characters.

In the next article we learned what is number systems, how to convert decimal to binary and binary to decimal number system and what are the applications of number system in computer systems.

Amar Nayak

22 years of experience in Training, Programming, and Research.
Certifications: IBM DB2, IBM WebSphere, IBM Tivoli, OCA, OCP, SCJP (OCJP), CCNA, RHCE,

https://prathamai.com

Leave a Reply

Your email address will not be published. Required fields are marked *