Number System in Computer Science
Number System
The number system is a way to represent numbers. The number systems are classified as below :
- Decimal Number System
- Binary Number System
- Octal Number System
- Hexadecimal Number System
Decimal Number System
In the decimal number system, the digits from 0 to 9 are used to represent numbers. In decimal numbers, each digit has a value based on its position which is known as place value. The value of the position increases by 10 times moving from right to left in the number.
As we use 10 digits to represent a number, it is also known as the Base 10 number system.
1Eg : 175 in decimal representation is as follows2175 = 1 * 10² + 7 * 10¹ + 5 * 10⁰3 = 100 + 70 + 5
Binary Number System
In the binary number system, every number is represented using a combination of 0 and 1 which are called bits. In the binary number system, positional notation is used in which each digit is multiplied by the appropriate power of two based on its position.
- 0 bit means No or False
- 1 bit means Yes or True
As we use only two bits to represent a number, it is also known as the Base 2 number system.
1Eg: 175 represented in binary number as 101011112175 = 128 + 0 + 32 + 0 + 8 + 4 + 2 + 13 = 1 * 2⁷ + 0 * 2⁶ + 1 * 2⁵ + 0 * 2⁴ + 1 * 2³ + 1 * 2² + 1 * 2¹ + 1 * 2⁰4It means (10101111)₂ = (175)₁₀
Octal Number System
In the Octal Number System, every number is represented using a combination of 0 to 7 numbers. In Octal number system positional notation is used in which each digit is multiplied by the appropriate power of 8 based on its position.
As we use 8 digits to represent a number, it is known as the Base 8 number system. Octal number is expressed as number₈ .
1Eg: 175 represented in octal number as (257)₈2175 = 2 * 8² + 5 * 8¹ + 7 * 8⁰3It means (257)₈ = (175)₁₀
Hexadecimal Number System
In the Hexadecimal Number System, every number is represented using a combination of 0 to 9 numbers and A to F letters. Here letters A to F represent numbers from 10 to 15. i.e A = 10, B = 11, C = 12, D = 13, E = 14, F = 15.
As we use 16 digits to represent a number, it is known as the Base 16 number system.
In Octal number system positional notation is used in which each digit is multiplied by the appropriate power of 16 based on its position. Octal number is expressed as number₁₆ .
1Eg: 175 represented in hexadecimal number as AF₁₆2 175 = 10 * 16¹ + 15 * 16⁰3 = A * 16¹ + F * 16⁰4So (175)₁₀ = (AF)₁₆
Number Systems Representation
Number System | Base | Symbols Used | Example | In Decimal Representation |
---|---|---|---|---|
Decimal Number System | 10 | 0,1,2,3,4,5,6,7,8,9 | (175)₁₀ | |
Binary Number System | 2 | 0,1 | (10101111)₂ | (175)₁₀ |
Octal Number System | 8 | 0,1,2,3,4,5,6,7 | (257)₈ | (175)₁₀ |
Hexadecimal Number System | 16 | 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F | (AF)₁₆ | (175)₁₀ |