• Home
  • Textbooks
  • Microsoft Visual Basic Programs to Accompany Programming Logic and Design
  • Writing Programs Using Loops

Microsoft Visual Basic Programs to Accompany Programming Logic and Design

Jo Ann Smith

Chapter 5

Writing Programs Using Loops - all with Video Answers

Educators


Section 1

Using a Do While Loop

03:44

Problem 1

In this exercise, you use what you have learned about writing
Do While loops. Study the following code and then answer Questions 1-3.
```
Const NUM_LOOPS As Integer $=7$
Dim numberOfTimes As Integer $=$ NUM_LOOPS
Do While numberOfTimes < NUM LOOPS
System.Console.WriteLine("Value of numberOfTimes is "
$\&$ number0fTimes)
numberOfTimes $=$ numberOfTimes +1
Loop
```
What is the loop control variable?
$\qquad$

Mayank Tripathi
Mayank Tripathi
Numerade Educator
03:44

Problem 2

In this exercise, you use what you have learned about writing
Do While loops. Study the following code and then answer Questions 1-3.
```
Const NUM_LOOPS As Integer $=7$
Dim numberOfTimes As Integer $=$ NUM_LOOPS
Do While numberOfTimes < NUM LOOPS
System.Console.WriteLine("Value of numberOfTimes is "
$\&$ number0fTimes)
numberOfTimes $=$ numberOfTimes +1
Loop
```
What is the output?
$\qquad$

Mayank Tripathi
Mayank Tripathi
Numerade Educator

Problem 3

In this exercise, you use what you have learned about writing
Do While loops. Study the following code and then answer Questions 1-3.
```
Const NUM_LOOPS As Integer $=7$
Dim numberOfTimes As Integer $=$ NUM_LOOPS
Do While numberOfTimes < NUM LOOPS
System.Console.WriteLine("Value of numberOfTimes is "
$\&$ number0fTimes)
numberOfTimes $=$ numberOfTimes +1
Loop
```
What is the output if the code is changed to Do While numberOfTimes <= NUM_LOOPS?

Check back soon!