Sub Task5()
Dim i As Integer, sum As Integer
sum = 0
For i = 2 To 10 Step 2
sum = sum + i
Next i
MsgBox "Сумма четных чисел от 1 до 10: " & sum
End Sub
Sub Task11()
Dim x As Double, y As Double
Dim row As Integer
row = 1
Cells(row, 1).Value = "x"
Cells(row, 2).Value = "y"
For x = -4 To 4 Step 0.2
row = row + 1
y = 2 * (x ^ 2) - 5 * x - 8
Cells(row, 1).Value = x
Cells(row, 2).Value = y
Next x
End Sub
Sub Task14()
Dim i As Integer, prod As Double
prod = 1
For i = 10 To 30 Step 5
prod = prod * i
Next i
MsgBox "Произведение чисел от 10 до 30, кратных 5: " & prod
End Sub
Sub Task21()
Dim startTime As Date, endTime As Date, currentTime As Date
Dim duration As Integer, row As Integer
startTime = TimeValue("06:00:00")
endTime = TimeValue("23:59:00")
duration = 45 ' Минуты в пути
currentTime = startTime
row = 1
Do While currentTime <= endTime
Cells(row, 1).Value = "Отправление: " & Format(currentTime, "hh:mm")
currentTime = DateAdd("n", duration, currentTime)
row = row + 1
Loop
End Sub
Sub Task31()
Dim i As Integer
For i = 0 To 10
Cells(i + 1, 1).Value = "2^" & i
Cells(i + 1, 2).Value = 2 ^ i
Next i
End Sub