Asked by Pete
Option Explicit
Dim Answer
Dim aScores()
Dim intNumScores
' Initialize Answer so loop will enter and execute
Answer = vbOK
Do While Answer = vbOK
intNumScores = CInt(InputBox("How many scores will you be entering?", "Enter
Number Of Scores"))
ReDim aScores(intNumScores)
Dim ii
Dim sngSum
Dim Score
' Initialize the sum to 0
sngSum = 0
For ii = 0 To intNumScores -1
Score = InputBox("Enter Score #" & ii + 1, "Enter Score")
' If user just hit enter, exit.
If Score = "" Then
Exit For
End If
' Store value in array
aScores(ii) = CSng(Score)
' Add new value to the running sum
sngSum = sngSum + aScores(ii)
Next
' If user entered a blank, exit
If Score = "" Then
Exit Do
End If
' Compute Average
Dim sngAvg
sngAvg = sngSum / intNumScores
Answer = MsgBox("The Average Score is: " & sngAvg & " Continue?", 65,
"Average")
Loop
Please can you check for me?
Dim Answer
Dim aScores()
Dim intNumScores
' Initialize Answer so loop will enter and execute
Answer = vbOK
Do While Answer = vbOK
intNumScores = CInt(InputBox("How many scores will you be entering?", "Enter
Number Of Scores"))
ReDim aScores(intNumScores)
Dim ii
Dim sngSum
Dim Score
' Initialize the sum to 0
sngSum = 0
For ii = 0 To intNumScores -1
Score = InputBox("Enter Score #" & ii + 1, "Enter Score")
' If user just hit enter, exit.
If Score = "" Then
Exit For
End If
' Store value in array
aScores(ii) = CSng(Score)
' Add new value to the running sum
sngSum = sngSum + aScores(ii)
Next
' If user entered a blank, exit
If Score = "" Then
Exit Do
End If
' Compute Average
Dim sngAvg
sngAvg = sngSum / intNumScores
Answer = MsgBox("The Average Score is: " & sngAvg & " Continue?", 65,
"Average")
Loop
Please can you check for me?
Answers
Answered by
Writeacher
Assistance needed.
Please type your <u>subject</u> in the <b>School Subject</b> box. Any other words, including obscure abbreviations, are likely to delay responses from a teacher who knows that subject well.
Please type your <u>subject</u> in the <b>School Subject</b> box. Any other words, including obscure abbreviations, are likely to delay responses from a teacher who knows that subject well.
There are no AI answers yet. The ability to request AI answers is coming soon!
Submit Your Answer
We prioritize human answers over AI answers.
If you are human, and you can answer this question, please submit your answer.