Here we are going to calculate (r - 1)’s complement and r’s complement for all base number systems.
How to calculate (r – 1)’s complement
Subtract all digit by (r – 1) – highest digit
For binary number:
Subtracting the all digit by (r – 1) then we will get opposite digit i.e. 1 is 0 and 0 is 1
For Octal:
For Decimal
For Hexadecimal
Now, r’s Complement
Process: First find (r – 1)’s complement then add 1 with LSB of digit then get r’s complement
For Octal
For Decimal
For Binary
Directly we can find 2’s complement of binary number:
From the LSB of digit left all zero until the first 1 appears, when got first 1, keep it as it is and complement the remaining part i.e. 1 to 0 and 0 to 1
Let
Let
Question:
Answer:
So, first we calculate 7’s complement then by adding 1, we got 8’s complement
So, we should convert 8 to corresponding octal
Correct was