To convert decimal numbers to binary, we repeatedly divide the number by 2 and collect the remainders. Then, we read the remainders in reverse order to get the binary representation.
Let's convert 245 and 24 to binary:
-
Decimal 245:
245÷2122÷261÷230÷215÷27÷23÷21÷2=122 (remainder 1)=61 (remainder 0)=30 (remainder 1)=15 (remainder 0)=7 (remainder 1)=3 (remainder 1)=1 (remainder 1)=0 (remainder 1)
Reading the remainders in reverse order, we get: 24510=111101012.
-
Decimal 24:
24÷212÷26÷23÷21÷2=12 (remainder 0)=6 (remainder 0)=3 (remainder 0)=1 (remainder 1)=0 (remainder 1)
Reading the remainders in reverse order, we get: 2410=110002.
Now, let's compute 24−245 using the subtraction rule in binary:
Binary 24:Binary 245:1100011110101
Since we're subtracting 245 from 24, we need to take the two's complement of 245 and then add it to 24:
- Take the one's complement of 245: 00001010.
- Add 1 to get the two's complement: 00001011.
Now, we can add 24 and the two's complement of 245:
+110000000101111001011
So, 24−245=−221 in binary.