Lecture09-w04-LIN-09232019-LoopExamples.pdf - Computing I COMP.1010 Fall 2019 Lecture 9 loop examples By Sirong Lin PhD University of Massachusetts

Lecture09-w04-LIN-09232019-LoopExamples.pdf - Computing I...

• 24

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

Computing I By: Sirong Lin, PhD University of Massachusetts Lowell COMP.1010, Fall 2019 Lecture 9: loop examples
Work Ready Life Ready World Ready Computing I, F2019, By Dr. Sirong Lin Upcoming Due Dates 2 Due Date Daily 07 09-23-2019 (M), 9:00pm Week 04 Readings MWF, 9:00am Week 04 Practice 09-29-2019 (Su), 9:00pm Daily 08 09-25-2019 (W), 9:00pm Daily 09 09-27-2019 (F), 9:00pm Daily 01-04 Resubmission 09-30-2019 (M), 9:00pm HW1 10-02-2019 (W), in class
Work Ready Life Ready World Ready Computing I, F2019, By Dr. Sirong Lin Homework Packet 1 Due: 10-2-2019 (W), in class finish the questions (1~58) by yourself find classmate(s) to study together, check answers, explain difference Q&A session in class on the due date Quiz 3
Work Ready Life Ready World Ready Computing I, F2019, By Dr. Sirong Lin 5 While Loop Example 2 — Please enter 100! Read integer 100 from the keyboard. The program will keep asking for 100 if the user gives a different number (let’s assume only integers will be entered for now)
Work Ready Life Ready World Ready Computing I, F2019, By Dr. Sirong Lin 6 While Loop Example 2 — Please enter 100! Recipe: 1. read an integer from the keyboard 2. check the integer, if it is 100, prints the number and ends the program 3. otherwise, repeat 1 and 2
Work Ready Life Ready World Ready Computing I, F2019, By Dr. Sirong Lin 7 While Loop Example 2 — please enter 100 (Cont’d) use if statement, the program only asks one extra time #include <stdio.h> int main(int argc, char*argv[]) { int input; printf("Please enter 100:\n”); scanf("%d", &input); if (input != 100) { printf("I'm sorry, you must enter 100:\n”); scanf("%d", &input); } printf("Got %d!\n", input); return 0; }

You've reached the end of your free preview.

Want to read all 24 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