# Easy way to learn Number System

The number system is the naming or representing the numbers or the mathematical value that count or measure the object is simply known as number system. We have different ways to represent the number system like Binary number system, decimal number system, octal number system, and Hexadecimal number system. Now, let’s talk in more details.

Digital logic refers to the use of electronic circuits to represent and manipulate binary information. Binary information consists of sequences of ones and zeros, which can be used to represent data, instructions, or signals in various computer systems and electronic devices.

Digital logic circuits are built using electronic components such as transistors, diodes, and resistors, and they perform basic operations such as AND, OR, NOT, XOR, and NAND on binary signals. These circuits can be combined in various ways to create more complex logic functions and circuits, such as flip-flops, registers, and microprocessors.

Digital logic is a fundamental concept in the field of computer engineering and is used in the design and development of digital systems, such as computers, smartphones, and other electronic devices. Understanding digital logic is essential for designing and implementing digital circuits and systems

## Decimal number system

The decimal number system is very popular in our daily life. In decimal number system ten symbols are used the end and the base of system is equal to 10. The ten symbol of digit are (0,1,2,3,4,5,6,7,8,9).

## Binary number system

Binary number system is one whose base is two(2). That is there is only two symbols or digits i.e (0,1).

## Octal number system

Octal number system is one whose base is 8. Eight symbols or digits are used (0,1,2,3,4,5,6,7).

Hexadecimal Number system is one whose base is 16. That means there is 16 symbol or digits i.e (0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F)

Here is example of conversion of binary to decimal number.

Example of decimal to binary number

## Complement of number system

A complement of Binary number system is obtained when each bit inverted i.e 0 change to 1 and 1 change to 0.

Types of complement

1. 1s complement
2. 2s complement

### 1’s complement

The 1’s complement of binary number system is defined as the value obtained by inverting all bits in binary representation of number . the 1’s complement of number then behaves like Negative of original number.

example 1’s complement of 0111 is 1000

or 1010 is 0101.

### 2’s complement

To get 2’s complement of binary Number.Simply invert number and add 1 at its LSB (least significant bit) of given result .

Example 2’s complement of 10101110

simply invert each bit of given binary number is 01010001 then add 1 at LSB ,

#### Subtraction by 1’s complement

The state to be followed in subtraction by 1’s complement are given below:

1. Write down the 1’s complement of subtrahend.
2. Add this with the minuend.
3. If the result of sum is carry over then it is dropped and 1 is added to the LSB .
4. If there is no carry over then invert the sum and get the final result and it is negative.

Example

(110101)2 - (100101)2
subtrahend= 100101
minuend=110101
1's complement of subtrahend is
011010
011010
+110101
1 001111
here 1 is carry over
so as we know the steps
001111
+1
(010000)2


Next example of no carry over

(101011)2 -(111001)2
Here Subtrahend = 111001
Minuend = 101011
now
1's complement of subtrahend
000110
000110
+101011
110001
here is no carry over

then simply invert the answer 110001 into 001110 and put negative sign before it



#### Subtraction by 2’s complement method

The complement operation is carried by means of following steps:

1. At first 2’s complement of subtrahend is calculated.
2. Then it is added to the minuend.
3. If the final result is carried over of the sum is one (1) then it is dropped and the result is positive.
4. But the final result is no carry over then do 2’s complement of the result and put negative sign in front of that.
Example:

(1001)2-(0100)2

Subtrahend = 0100
Minuend = 1001

2's complement of subtrahend is 1100

1011 invert and add 1 in LSB

1011
+   1
1100

1100
+1001
1 0101

here 1 carry over, as we know if carry over drop the carry

Next example

(0110)2-(1011)2

subtrahend = 1011
Minuend = 0110

2's complement of subtrahend is

0100
+1
0101

0101
+0110
1011

here is no carry over
now 2's complement of this sum.

0100
+1
0101

-(0101)2



## 9’s And 10’s complement

9’s complement = It is obtained by subtracting each digit of number from nine .

Example:

9's complement of 347.

999
-347
(652)10



10’s complement = It is obtained by adding 1 in the 9’s complement.

Example:

find the 10's complement of 347 is

999
-347
652
Now
652
+1
(653)10
this is the 10's complement of 347...



### Subtraction from 9’s complement

for example:

(745)10-(436)10 using 9's complement

1. first find the 9's complement of subtrahend

436 is subtrahend here
Now

999
-436
563

(745) is here minuend

563
+745
1 308
here 1 is carry over

3. now if carry over is obtained the number is positive and then add that carry to LSB of that sum

308
+1
309

4. if there is no carry over then that number is negative so take 9's complement of that sum and out neg sign in front of that result.

(436)10 - (745)10
subtrahend = 745
minuend = 436
9's complement of subtrahend

999
-745
254

254
+ 436
690
here is no carry over so do 9's complement of that sum

999
- 690
309
-(309)10


### Subtraction from 10’s complement

example
(928)10 -(416)10 using 10's complement

subtrahend = 416
minuend = 928

1. find the 10's complement of subtrahend

999
- 416
583
+1
(584) = this is 10's complement

583
+928
1 512
here 1 is carry over

3. If there is carry over it means that it is positive and ignore the carry .
(512)10

4. If there is no carry over then that means it is negative than take 10's complement of the sum and place neg sign before.

(3250)10-(72532)10

subtrahend = 72532
minuend = 3250

10's complement of the subtrahend is

99999
-72532
27467
+1
27468

27468
+  3250
30718
here is no carry over

Now, again 10's complement of sum result

99999
- 30718
69281
+1
69282
,

## Arithmetic operation with signed numbers

The two numbers in an addition the addend and the augent the result is sum . There are four cases arrises.

1. Both are positive .
2. Positive numbers with magnitude larger than negative number.
3. Negative number with magnitude larger than positive number.
4. both are negative .

### Both are positive

Addition of two positive number result a positive number.

example +7 and +4

00000111
+00000100
00001011

### Positive number with magnitude larger than negative

Addition of positive number and negative number results positive.
example

+15 and -6

here,

+15 =00001111
6=00000110
-6=11111001
+1
11111010

now,

00001111
+11111010
1 00001001

here this 1 carry is dropped and answer is
(00001001)2

### Negative number with magnitude larger than positive.

Addition of the positive no and larger negative number results negative no in 2's complement form.
-24 and +16
here

+16=00010000
24=00011000
-24=11100111
+1
11101000
now

00010000
+11101000
11111000
here no carry over
so do 2's complement of this sum

00000111
+1
(00001000)2

-(00001000)2


### Both are negative

Addition of two negative number results negative numbers is 2's complement.

-5 and -9
here

5=00000101
-5=11111010
+1
>  11111011
9=00001001
-9=11110110
+1
>11110111

now

11111011
+11110111
>1 11110010

here 1 is carry over
so