Number System in Computer Science is very important for representing data into computer systems. In this article, you will learn about the number systems and their conversion.
The number system in Computer
The number system is very useful to represent data with specific symbols and digits. Data representation can be done through numbers. So we can say, it is a way of using numbers with relevant symbols to work upon data. There are three main properties of the number system.
- The Base: The total number of digits used Ex. 10 is the base for the decimal number system we use
- Numbers: The numbers used Ex 0 to 9
- The Position: Position of each number from right to left
Type of Number System in computer
There are four types of number system in computer science.
|Number System||Base||Digits used||Representation|
|Binary||2||0 and 1||(10010)2|
|Decimal||10||0 to 9||(199)10|
|Octal||8||0 to 7||(234)8|
|Hexadeimal||16||0 to 9, A to F||(2DEF)16|
You can convert a number from one system to another number system. There are two methods used for the conversion of numbers.
Decimal to others:
- Divide the decimal number with the base
- Note down remainders in each step
- Write down reminders in reverse order
Ex. Convert (98)10 = (?)2
Others to decimal
- Write the position of each number from right to left, start with 0
- Multiply and the number with raised power of the base value
Ex. Convert (100110)2 = (?)10
Decimal to Octal
Octal to Decimal
= (2 × 83) + (5 × 82) + (7 × 81) + (7 × 80)
= (2 × 512) + (5 × 64) + ( 7 × 8) + (7 × 1)
= 1024 + 320 + 56 + 7
Decimal to HexaDecimal
(16119)10 = (?) 16
Ans. : (16119)10 = (3EF7) 16
The fractional part conversion is quite simple to convert. Follow this method to convert:
Decimal to Binary
- Multiply the decimal number with the base
- Note down the integer part and continue step 1 with the fractional part
- Continue the above steps until the fractional part will be 0 or repeat 5 to 6 steps
- Write down the number from top to bottom
Now you convert octal to decimal, hexadecimal to octal and vice versa…
There are some shortcut methods also used to convert octal to binary and vice versa.
You can refer to this tutorial also for the same purpose.
As in Binary system only 0s and 1s are used to represent the number, addition rules are as following:
- 0 + 0 = 0
- 0 + 1 = 1
- 1 + 0 = 1
1 + 1 = 10 (0 with carry 1)
- 10101 + 10001
2. 11101 + 10101 + 10001
In the above examples, you have seen the common and basic rules for addition. In the examples, C refers to carry on top. In the first example, 1 + 1 = 10, So 0 with carrying 1 is processed and carry forwarded as usual. In second example, first digit calculation 1 + 1 + 1 i.e. 1 + 1 = 10 then 10 + 1 = 11. similarly next digits computations done. In last position 1 + 1 + 1 + 1 = 1 + 1 = 10 + 1 = 11 + 1 = 100.
Use this calculator while doing addition: Click here to open the calculator.
Thank you for reading the post. You have any doubt or query do not hesitate about it. Post your doubt or query as a comment. We will respond to your comment as soon as possible.
Share this article with your friends.
Thank you for reading, enjoy learning!!