https://pastein.ru/t/qH

  скопируйте уникальную ссылку для отправки


Const Pi As Double = 3.14159265358979
Function Factorial(ByVal n As Integer) As Long
If n = 0 Or n = 1 Then
Factorial = 1
Else
Factorial = n * Factorial(n - 1)
End If
End Function
Sub Task4()
Dim s As Double
Dim y As Double
Dim t As Double
Dim x As Double
Dim n As Integer

x = InputBox("Введите x", "Введите x", 2.094395)
n = 1
t = 1
While Abs(t) > 10 ^ (-6)
t = Cos((2 * n + 1) / 4 * Pi) * (x - Pi / 2) ^ n / (Factorial(n) * 2 ^ n)
s = s + t
n = n + 1
Wend
s = 1 / Sqr(2) + s
y = Cos(x / 2)
MsgBox "S = " & s & Chr(13) & Chr(10) & "F(x) = " & y
End Sub