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 variable contains 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
3.49 Rating (159 Votes )
There are 3 Steps involved in it
a For Each intX As ... View full answer
Get step-by-step solutions from verified subject matter experts
Document Format (2 attachments)
1814_60b8c12285ef6_823605.pdf
180 KBs PDF File
1814_60b8c12285ef6_823605.docx
120 KBs Word File
