Explain in detail about r’s and (r-1)’s compliments in detail with examples.in cao
Answers
Steps to find (r-1)’s complement:
To find (r-1)’s complement, subtract each digit of the given number from from the largest number in that number system. For instance, if the number is a three digit number in radix 9, then subtract the number from 888 as 8 is the largest number in radix 9 number system. The obtained result is the (r-1)’s complement.
Steps to find r’s complement:
To find r’s complement, just add 1 to the calculated (r-1)’s complement.
Here is an example:
Q. Find the 7’s & 8’s complement of the number (5 6 3)8
Step 1: Identify the base (or) radix. Here r = 8.
Step 2: Since 7 is the largest digit in the number system, subtract each digit of given number from 7 i.e. if it’s a three digit number, subtract the number from 777.
∴ (214)8 is the 7’s complement of given number
Step 3 : To find r’s complement i.e. 8’s complement then add ‘1’ to the result of 7’s complement number
∴ (215)8 is the 8’s complement of the given number.