Sub CalculateAverage() Dim total As Double Dim count As Integer Dim average As Double Dim number As Double
count = 0 total = 0 Do number = InputBox("Введите число (для выхода введите 0):") If number <> 0 Then total = total + number count = count + 1 average = total / count MsgBox "Среднее значение: " & average End If Loop Until number = 0
Option Explicit
Sub CalculateAverage()
count = 0Dim total As Double
Dim count As Integer
Dim average As Double
Dim number As Double
total = 0
Do
number = InputBox("Введите число (для выхода введите 0):")
If number <> 0 Then
total = total + number
count = count + 1
average = total / count
MsgBox "Среднее значение: " & average
End If
Loop Until number = 0
End Sub
Sub Main()
CalculateAverage
End Sub