Project 2 due Friday at midnight CodeLab (conditionals, loops) due Monday at midnight SAS exam review: Sunday 7-9pm, Carter Learning Center Exam 1 Tuesday during class break: leave the structure we?re in (switch, loop) continue: skip the rest of the current iteration, start on the next one while (?) { ? continue; rest of statements } Example: write a for-loop that adds 10 numbers from the user and prints the sum. If the user enters a negative number, stop early and print sum up to that point. Example: same idea, but just skip all the negative numbers Nested loops outer loop { inner loop { statements } statements } Often done with ?grids? of elements Print: * * * * * * * * * * * * * * * * * * * * 4 rows, 5 columns outer loop goes through all the rows inner loop goes through all cols (elements on cur. row) Now we want to print: 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 Next, print: 0 : row 0, 1 element 0 1 : row 1, 2 elements 0 1 2 0 1 2 3 0 1 2 3 4 Example: repeatedly ask user for a number until they want to quit each time, print the left-most digit of the number outer loop: keep looping as long as they want to continue ask for a number while number is > 9, divide it by 10 print the remaining (left-most digit) ask if want to continue Example: printing the factors of a number 12 = 2 * 2 * 3 loop through possible factors inner loop loops through repetitions of current factor
STUDYBLUE makes things that make you better at school.
Things like
online flashcards with photos and audio.
Things like personalized quizzes and friendly reminders about when (and what) to study next.
Think of it as a digital backpack™: access to all of your study materials online and on your phone.
STUDYBLUE exists to make studying efficient and effective for every student, for free.
Join us.
“I have used this website for three exams, and I see a huge difference in my test results.”
Naj