已知X=+1011,Y=-0100,用补码计算X+Y和X-Y

问题描述:

已知X=+1011,Y=-0100,用补码计算X+Y和X-Y

X的原码00001011,转换成补码补码00001011
-Y的原码0000100,按位取反1111011,)→加1为1111100,
Y补码是11111100
X+Y为00001011+11111100=00000111,
X-Y为00001011-11111100=00001111