Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Here\'s what I\'ve been given and what I have to do is: 1. Write a counter-contr

ID: 3758879 • Letter: H

Question

Here's what I've been given and what I have to do is:

1. Write a counter-controlled Do While loop that uses the loop control variable to take on the values of 0 through 10. Remember to initialize the loop control variable before the program enters the loop.
2. In the body of the loop, multiply the value of the loop control variable by 10 and by 100. Remember to change the value of the loop control variable in the body of the loop.


' Multiply.vb - This program prints the numbers 0 through 10 along
' with these values multiplied by 10 and by 100.
' Input: None
' Output: Prints the numbers 0 through 10 along with these values multiplied by 10 and by 100.
Option Explicit On
Option Strict On
Module Multiply
   Sub Main()
        ' Declarations
   Const head1 As String = "Number: "
        Const head2 As String = "Multiplied by 10: "
        Const head3 As String = "Multiplied by 100: "
        Dim numberCounter As Integer ' Numbers 0 through 10
        Dim byTen As Integer        ' Stores the number multiplied by 10
        Dim byHundred As Integer    ' Stores the number multiplied by 100
        Const NUM_LOOPS As Integer = 10   ' Constant used to control loop
   ' This is the work done in the housekeeping() procedure
        System.Console.WriteLine("0 through 10 multiplied by 10 and by 100")
   ' This is the work done in the detailLoop() procedure  
        ' Write the Do While loop here


    End Sub ' End of Main() procedure
End Module ' End of Multiply module

Explanation / Answer

Below is the required Do While loop

   Do While numberCounter >= 0 And numberCounter <= NUM_LOOPS
   byTen = i * 10
   byHundred = i * 100
   System.Console.WriteLine("{0} = {3}, {1} = {4}, {2} = {5}", head1, head2, head3, numberCounter, byTen, byHundred)
   numberCounter = numberCounter + 1
   Loop