Learning Objectives and Outcomes
Use pseudocode/flowcharts to represent repetition structures.
Create While, Do-While, and Do-Until conditional loops.
Describe the implications of an infinite loop.
Assignment Requirements
Answer:
I. Short Answer Review Questions 1-5, starting on page 213
1. You visually set them apart from surrounding code.
2. A pretest loop is a loop tests the conditions before performing the iteration. A posttest loop performs the iteration then test the condition.
3. A condition controlled loop repeats a specific number of times.
4. A count-controlled loop repeats a specific number of times.
5. Initiation, Test, and Increment
II. Algorithm Workbench Review Questions 1, 2, 7, and 8, starting on page 213
1. Main()
Dm number As Integer
Dm product As Integer
While product <100 Console.writeline(*enter a number*)
Number = Console.readline()
Product – numbers * 10 Console.writeline(*the number you entered: * &numbers& * Multiplied by ten is: * &product) End white
Console.writeline(*press enter to continue…*) Console.readkey() End sub
2. Declare Integer x = 1
While x > 0 Display “Enter a number. “ Input x
End While
Declare x as Integer = 1
Do
Display “Enter a number.”
Input x
If x ! = 0 then
Display “Try again”
End if
Until x = 0
3. Convert the While loop in the following code to a Do- While loop:
Declare Integer x = 1
While x > 0 Display " Enter a number."
Input x
End While
Declare x as integer = 1
Do
Display “ Enter a number:”
Input x
If x != 0 then
Display “ Try again”
End if
Until x = 0
Display “ The number you entered is correct”
III. Programming Exercises 1, 3, and 4, starting on page 214
Required Resources
Textbook
Submission Requirements
Submit your written answers to your instructor at the beginning of Unit 8.