ModuleModule1
'Visual Basic Console Application
Sub Main()
'Integer array to hold test scores; for fractional scores, use data type Double
Dim testScores AsInteger() = {78, 87, 65, 92, 77, 95, 80, 81, 67, 100}
Dim minScore AsInteger = 100
Dim maxScore AsInteger = 0
'Double data type accommodates fractional average (for example, 87.2)
Dim averageScore AsDouble = 0
For counter AsInteger = 0 To testScores.GetUpperBound(0)
If testScores(counter) < minScore Then
minScore = testScores(counter)
EndIf
If testScores(counter) > maxScore Then
maxScore = testScores(counter)
EndIf
averageScore += testScores(counter)
Next
averageScore /= testScores.Length
Console.WriteLine("The minimum score is: " & minScore.ToString)
Console.WriteLine("The maximum score is: " & maxScore.ToString)
Console.WriteLine("The average score is: " & averageScore.ToString)
Console.ReadLine()
EndSub
EndModule
'Visual Basic Console Application
Sub Main()
'Integer array to hold test scores; for fractional scores, use data type Double
Dim testScores AsInteger() = {78, 87, 65, 92, 77, 95, 80, 81, 67, 100}
Dim minScore AsInteger = 100
Dim maxScore AsInteger = 0
'Double data type accommodates fractional average (for example, 87.2)
Dim averageScore AsDouble = 0
For counter AsInteger = 0 To testScores.GetUpperBound(0)
If testScores(counter) < minScore Then
minScore = testScores(counter)
EndIf
If testScores(counter) > maxScore Then
maxScore = testScores(counter)
EndIf
averageScore += testScores(counter)
Next
averageScore /= testScores.Length
Console.WriteLine("The minimum score is: " & minScore.ToString)
Console.WriteLine("The maximum score is: " & maxScore.ToString)
Console.WriteLine("The average score is: " & averageScore.ToString)
Console.ReadLine()
EndSub
EndModule