Hello Computer Science: loops

Prepare today for the demands of tomorrow.

hello-world.com
Privacy
Policy

Site map

Hello-World

At the end of this lesson you will be able to write a program that will use while, do, and for loops. You will know the difference between a for, while, and do loop.

1. Print and read the lesson. (Punch, staple, put in your binder.)
Loop Lesson 2: while and do loops

2. Run each of the programs from the lesson, work with the flowchart if one is provided:

While1: print 0 1 2 3 4 5
While 2: print 0 1 2 3 4 5 using ++
Blast OFF: using a while loop
Average: using a while loop until negative number is entered. Flowchart
Total2: just 2 variables Flowchart
Total3: using a for loop to read 3 numbers Flowchart
Total4: uses a for loop to read N numbers Flowchart
Do Average: uses a do loop to find average Flowchart
Fahrenheit to Celcius: Flowchart

To get the most out of these programs

3. Using the sample programs as a model, write a program that will loop to input numbers. Print the total, count, average, smallest and largest.

Follow good programming habits:


Copyright © Hello World Publications. All rights reserved worldwide.

hello-world.com
Privacy
Policy

Site map

Hello-World