Lecture11-w04-LIN-02132019-nestedIf-Expressions.pdf - Computing I COMP.1010 Fall 2019 Lecture 11 Two’s Complement to Decimal nested if-else By Sirong

# Lecture11-w04-LIN-02132019-nestedIf-Expressions.pdf -...

• 28

This preview shows page 1 - 10 out of 28 pages.

Computing I By: Sirong Lin, PhD COMP.1010, Fall 2019 University of Massachusetts Lowell University of Massachusetts Lowell Lecture 11: Two’s Complement to Decimal, nested if-else,
Work Ready Life Ready World Ready Computing I, F2019, By Dr. Sirong Lin Upcoming Due Dates 2 Due Date Daily 09 09-27-2019 (F), 9:00pm Week 04 Practice 09-29-2019 (Su), 9:00pm Week 05 Readings MWF, 9:00am Two’s complement HW 09-30-2019 (M), before class Daily 10 09-30-2019 (M), 9:00pm Daily 11 10-02-2019 (W), 9:00pm HW1 10-02-2019 (W), in class Program 1 10-09-2019 (W), 9:00pm
Work Ready Life Ready World Ready Computing I, F2019, By Dr. Sirong Lin Program 1 Start working on the Program early! Don’t wait till the last minute. One day is not enough for most students. Due: 10-09-2019 (W), 9:00pm Worth: 50 points 3
Work Ready Life Ready World Ready Computing I, F2019, By Dr. Sirong Lin Program 1 4
Work Ready Life Ready World Ready Computing I, F2019, By Dr. Sirong Lin Outline Two’s Complement Nested if-else 5
Work Ready Life Ready World Ready Computing I, F2019, By Dr. Sirong Lin Convert Two’s complement to Decimal 6
Work Ready Life Ready World Ready Computing I, F2019, By Dr. Sirong Lin Two’s complement to Decimal step 1: check the sign bit 0: positive number, use the regular method of converting unsigned binary to decimal by adding the place values for each bit. Stop. 1: negative number, continue to Step 2-4; step 2: invert all the bits step 3: add 1, use the regular method binary -> decimal by adding the place values for each bit step 4: add the negative sign to the decimal number 7
Work Ready Life Ready World Ready Computing I, F2019, By Dr. Sirong Lin Two’s complement to Decimal (Cont’d) step 1: check the sign bit positive, add place values + (1+2+4) = +7 8 Convert 0111 two’s complement to decimal
Work Ready Life Ready World Ready Computing I, F2019, By Dr. Sirong Lin Two’s complement to Decimal (Cont’d) 9

#### You've reached the end of your free preview.

Want to read all 28 pages?

• Fall '15

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern

Stuck? We have tutors online 24/7 who can help you get unstuck.
Ask Expert Tutors You can ask You can ask ( soon) You can ask (will expire )
Answers in as fast as 15 minutes
Ask Expert Tutors