Question: The intNums array is declared as follows: Dim intNums() As Integer = {10, 5, 7, 2}. Which of the following blocks of code correctly calculates
The intNums array is declared as follows: Dim intNums() As Integer = {10, 5, 7, 2}.
Which of the following blocks of code correctly calculates the average value stored in the array? The intTotal, intSub, and dblAvg variables contain the number 0 before the loop is processed.
a. For Each intX As Integer In intNums intTotal += intX Next intX dblAvg = intTotal / intNums.Length
b. For Each intX As Integer In intNums intTotal += intNums(intX)
Next intX dblAvg = intTotal / intX
c. For Each intX As Integer In intNums intTotal += intNums(intX)
intX += 1 Next intX dblAvg = intTotal / intX
d. none of the above
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
