The decimal number 22 is stored in a 6bit signed integer for
Solution
Two\'s complement method is one of the methods used in the representation of signed integers to binary.This method is commonly used in computers to handle negative numbers and hence, the method used here is 2\'s complement method.
An N-bit (In this case 6 bits) two\'s-complement numeral system can represent every integer in the range (2N1) to +(2N1 1) which leads to the range -32 to +31. Since -22 is within the range, it can be converted to the respective binary value.
Here, the binary value of -22 is 101010 in two\'s complement.
Steps to finding the two\'s complement:
Let us convert the number to binary (ignore the sign for now) 22 is 010110 in binary (considering 6 bits of space) and we assume -22 to be the same (010110) at first
Since the number is negative,
We find the complement (invert 0\'s and 1\'s) e.g. -22 is 010110 so finding the complement is 101001
Add 1 to the complement 101001 + 1 = 101010. Therefore, -22 in two\'s complement is 101010.
