08-feb11

08-feb11 - COMP110 Loops TabithaPeckM.S February11,2008...

Info iconThis preview shows pages 1–9. Sign up to view the full content.

View Full Document Right Arrow Icon
COMP 110 Loops Tabitha Peck M.S. February 11, 2008 MWF 3-3:50 pm Philips 367 1
Background image of page 1

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

View Full DocumentRight Arrow Icon
Announcements Office hours THIS WEEK ONLY! Monday 4:00-5:00 Tuesday 1:30-2:30 in Sitterson 252!!!!!!! Program 2 Due Wednesday by 3:00 Grades online 2
Background image of page 2
Questions? 3
Background image of page 3

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

View Full DocumentRight Arrow Icon
Today in COMP 110 Loops Body Initializing Statements Ending a loop Bugs 4
Background image of page 4
Loop Body count = 1; while (count <= num) { System.out.print(count + “, “); count++; } Repeated code Write pseudocode and turn repeated statements into loops 5
Background image of page 5

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

View Full DocumentRight Arrow Icon
Pseudocode for loop Get user input sum = sum + input Get user input sum = sum + input Get user input sum = sum + input Average sum 6 Repeated  statements in  pseudocode  become your  loop
Background image of page 6
Body of our loop Get user input sum = sum + input
Background image of page 7

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

View Full DocumentRight Arrow Icon
Initializing Statements sum = sum + input Variables in your loop must be initialized (set to a value) before the loop What is initialization of sum?
Background image of page 8
Image of page 9
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/02/2009 for the course COMP 110 taught by Professor Stotts during the Spring '08 term at UNC.

Page1 / 20

08-feb11 - COMP110 Loops TabithaPeckM.S February11,2008...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online