CORRECT QUESTION:
You have just started working for XYZ Solutions as a programmer. Your first assignment is to review and correct various code so that you can become familiar with the company’s programsThe following code is not working properly. The message should display four times. What needs to be changed for the code to work properly?
Do While intCounter < 5
MessageBox.Show("OK")
intCounter = intCounter + 1
Loop
A. intCounter = 1 should be added before the Do statement
B.intCounter = 0 should be added before the Do statement.
C. intCounter < 5 should be changed to intCounter = 5.
D. intCounter < 5 should be changed to intCounter > 5
Answer:
A) intCounter = 1 should be added before the Do statement
Step-by-step explanation:
The variable intCounter is used to determine how many times the loop will iterate. setting it to 1 and stating the while condition to be less than five means the while loop will iterate 1,2,3,4 times and then stop since the condition says less than 5.