Lecture03-w02-LIN-09092019-Printf-BinaryConversion.pdf - Computing I COMP.1010 COMP.1010,Spring Fall 2019 2019 Lecture 3 Basics in C — Decimal to

Lecture03-w02-LIN-09092019-Printf-BinaryConversion.pdf -...

This preview shows page 1 - 9 out of 29 pages.

Computing I By: Sirong Lin, PhD COMP.1010, Spring 2019 University of Massachusetts Lowell COMP.1010, Fall 2019 Lecture 3: Basics in C — Decimal to Binary & Printf
Image of page 1
Work Ready Life Ready World Ready Computing I, F2019, By Dr. Sirong Lin Take a worksheet packet Form group of 3 (or 2, 4), each group better has one computer 2
Image of page 2
Work Ready Life Ready World Ready Computing I, F2019, By Dr. Sirong Lin Upcoming Due Dates 3 Due Date Daily 01 09-09-2019 (M), 9:00pm Week 01-Reading & Practice 09-10-2019 (Tu), 9:00pm Daily 02 09-11-2019 (W), 9:00pm Daily 03 09-13-2019 (F), 9:00pm Week 02 Reading 1-3 MWF, 9:00am Week 02 Practice 09-15-2019 (Su), 9:00pm
Image of page 3
Work Ready Life Ready World Ready Computing I, F2019, By Dr. Sirong Lin Outline Decimal to Binary Get your feet wetter — learn more about C printf function 4
Image of page 4
Work Ready Life Ready World Ready Computing I, F2019, By Dr. Sirong Lin 5 Represent (unsigned) numbers in Binary Binary System Binary->Decimal Decimal->Binary
Image of page 5
Work Ready Life Ready World Ready Computing I, F2019, By Dr. Sirong Lin Decimal —> Binary (Method 1) 6 Short Division by Two with Remainder Idea: start from the least power of 2, find how many 1s, 2s, 4s… 27, 16, 156 in binary? 1024 512 256 128 64 32 16 8 4 2 1 2 3 2 2 2 1 2 0 2 10 2 4 2 9 2 5 2 6 2 7 2 8 Place Value
Image of page 6
Work Ready Life Ready World Ready Computing I, F2019, By Dr. Sirong Lin 7
Image of page 7
Work Ready Life Ready World Ready Computing I, F2019, By Dr. Sirong Lin Decimal —> Binary (Method 1) (Cont’d) 8 Repeat dividing the number by 2 until the quotient is zero Translated number is read bottom up, recording the bits from left to right.
Image of page 8
Image of page 9

You've reached the end of your free preview.

Want to read all 29 pages?

  • Fall '15

What students are saying

  • Left Quote Icon

    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.

    Student Picture

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

  • Left Quote Icon

    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.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    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.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

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