Identify and correct the error(s) in each of the following (you may simply need to add code):
1.Assume that z has been initialized to 50. The values from 0 to 50 should be totaled.
While (z>=0)
sum = sum + z
2.Assume that y and total are declared as Integers
total = 0
Do Until y = -1
Print y
y = InputBox(“Enter a value, value input”)
total = total + y
Loop
3.Assume that k is declared as an Integer. The loop should iterate until -1 is input.
Do While k <> -1
InputBox(“Enter a number -1 to quit:”, VB6)
Loop
4.Assume that y is declared as Variant
For y = o.1 To 1.0 step .2
Print y
Next .2
5.Assume that the variable testVariable has been declared as Integer
Do Loop Not testVariable
Print “Inside of Loop”
Until
Comments
Leave a comment