I would like to ask for help with discrete mathematics, especially two's complement
Step 1:
Find the 2's complement of the number to be subtracted.
Here we have to subtract 19 from 31, therefore first we will find 2's complement.
2's Complement of 19
The binary equivalent of 19 is 19 = (10011)2
And the binary equivalent of 31 is = (11111)2
Now1's complement of 10011 is 01100
Adding 1 to 1's compliment
01100
+ 00001
= 01101
Hence 2's complement of 19 is 01101
Step 2:
We add the 2's complement of 19 to 31. Therefore,
31 - 19 = 31 + (2's complement of 19)
= 11111 + 01101
11111
01101
= 101100
Step 3:
Now ignoring the last cary digit, which is 1, we get
31 - 19 = (01100)2
31 - 19 = 12
Here 411 > 123, so we start writing 411 in terms of 123
Step 1: 411 = 123 x 3 + 42
Step 2: 123 = 42 x 2 + 39
Step 3: 42 = 39 x 1 + 3
Step 4: 39 = 3 x 13 + 0
Since we see that the remainder is zero, therefore, we stop dividing, and the resulting GCD of 123 and 411 is 3
Comments
Leave a comment