HW2_solution

# HW2_solution - SOLUTION ECE 2504 Introduction to Computer...

This preview shows pages 1–3. Sign up to view the full content.

SOLUTION ECE 2504 Introduction to Computer Engineering, Fall 2008 Homework 2 Due date: 8 Sep 08, 11:59pm Show all work. 1. (6 pts) Find the decimal equivalent of the following two’s complement numbers: 1010110; 10000101; 01011011; 111100110; 10011011; 11110000 a. 1010110 is the 2’s complement of 0101010 0101010 = 1×2 5 + 0×2 4 + 1×2 3 + 0×2 2 + 1×2 1 + 0×2 0 = 32 + 0 + 8 + 0 + 2 + 0 = 42 1010110 (- 42) 10 b. 10000101 is the 2’s complement of 01111011 01111011 = 1×2 6 + 1×2 5 + 1×2 4 + 1×2 3 + 0×2 2 + 1×2 1 + 1×2 0 = 64 + 32 + 16 + 8 + 0 + 2 + 1 = 123 10000101 (- 123) 10 c. 01011011 is a positive number 01011011 = 1×2 6 + 0×2 5 + 1×2 4 + 1×2 3 + 0×2 2 + 1×2 1 + 1×2 0 = 64 + 0 + 16 + 8 + 0 + 2 + 1 91 10 d. 111100110 is the 2’s complement of 000011010 000011010 = 0×2 7 + 0×2 6 + 0×2 5 + 1×2 4 + 1×2 3 + 0×2 2 + 1×2 1 + 0×2 0 = 0 + 0 + 0 + 16 + 8 + 0 + 2 + 0 = 26 111100110 (- 26) 10 e. 10011011 is the 2’s complement of 01100101 01100101 = 1×2 6 + 1×2 5 + 0×2 4 + 0×2 3 + 1×2 2 + 0×2 1 + 1×2 0 = 64 + 32 + 0 + 0 + 4 + 0 + 1 = 101 10011011 (- 101) 10 f. 11110000 is the 2’s complement of 00010000 00010000 = 0×2 6 + 0×2 5 + 1×2 4 + 0×2 3 + 0×2 2 + 0×2 1 + 0×2 0 = 0 + 0 + 16 + 0 + 0 + 0 + 0 = 16 11110000 (- 16) 10

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
SOLUTION 2. (6 pts) Perform the subtraction of the following unsigned decimal numbers by taking the 10’s complement of the subtrahend: 7240 – 3541; 1683 – 6370; 25 – 75. a.
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 06/15/2009 for the course ECE 2504 taught by Professor Klcooper during the Fall '08 term at Virginia Tech.

### Page1 / 6

HW2_solution - SOLUTION ECE 2504 Introduction to Computer...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online