Solved

Which of the Following Code Fragments Calculates the Average of 5

Question 29

Multiple Choice

Which of the following code fragments calculates the average of 5 numbers input with an input box, and displays the result in lblResult?


A) intCount = 5
intSum = 0
Do While intCount = 5
IntSum = CInt(InputBox("enter a number") )
SngAvg = intSum / intCount
LblResult.Text = sngAvg.ToString()
Loop

B) intCount = 0
intSum = 0
Do While intCount < =5
IntValue = CInt(InputBox("enter a number") )
IntSum = intSum + intValue
Loop
SngAvg = intSum / intCount
LblResult.Text = sngAvg.ToString()

C) intCount = 0
intSum = 0
Do While intCount < = 5
IntValue = CInt(InputBox("enter a number") )
IntSum = intSum + intValue
IntCount += 1
Loop
SngAvg = intSum / intCount
LblResult.Text = sngAvg.ToString()

D) intCount = 0
intSum = 0
Do While intCount < 5
IntValue = CInt(InputBox("enter a number") )
IntSum = += intValue
IntCount += 1
Loop
SngAvg = intSum / intCount
LblResult.Text = sngAvg.ToString()

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions