08-feb11

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

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

COMP 110 Loops Tabitha Peck M.S. February 11, 2008 MWF 3-3:50 pm Philips 367 1

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

View Full Document
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
Questions? 3

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

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

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

View Full Document
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
Body of our loop Get user input sum = sum + input

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

View Full Document
Initializing Statements sum = sum + input Variables in your loop must be initialized (set to a value) before the loop What is initialization of sum?
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
Ask a homework question - tutors are online