1 CSE1301 Computer Programming Lecture 33 Supplement: Conversions: Unsigned Binary to Decimal Decimal to Unsigned Binary
2 Converting Decimal to/from Unsigned Binary Analogy: Giving a $69.10 change from largest to smallest denomination: = 1 $50 bill = 1 $10 bill = 1 $5 bill = 2 $2 coin = 1 10c coin
Converting Decimal to/from Unsigned Binary Bit position. Decimal value.
Converting Decimal to/from Unsigned Binary Bit position. Decimal value.
5 Unsigned Binary to Decimal Example: Convert the unsigned binary number to decimal
6 Unsigned Binary to Decimal
8 Unsigned Binary to Decimal = 154 So, in unsigned binary is 154 in decimal.
9 Decimal to Unsigned Binary Example: Convert the decimal number 105 to unsigned binary.
10 Q. What is the highest power of 2 that is less than or equal to 105? A Next, consider the difference: =
11 1 Q. What is the highest power of 2 that is less than or equal to 41? A Next, consider the difference: = 9
12 1 Q. What is the highest power of 2 that is less than or equal to 9? A Next, consider the difference: = 1
13 1 Q. What is the highest power of 2 that is less than or equal to 1? A Next, consider the difference: = 0 Done!
14 1 Finally, fill the empty boxes with zeros So, 105 decimal is in unsigned binary.