Текст программы:
Dim
y As Long, max As Long, xn As Integer
Dim
xk As Integer
Dim
xmax As Integer, dx As Integer
Dim
L As String
Private
Sub CommandButton1_Click()
xn =
Val(TextBox1.Text)
xk =
Val(TextBox2.Text)
dx =
Val(TextBox3.Text)
max
= x ^ 5 * xn
For
i = xn To xk Step dx
L =
""
y =
x ^ 5 * i
If i >= 3 And i <= 6 Thеn
y = factor(i - 2)
If i
> 6 And i <= 11 Then y = factor(i - 5)
If y
> max Then
max
= y: xmax = 1
End
If
L =
L + "Y(" + Str(i) + ")=" + Str(y) + " "
ListBox1.AddItem
(L)
Next
i
End
Sub
Function
factor(n As Integer) As Long
If n < 0 Then MsgBox "Введите
n>0!
If n = 0 Then factor = 1
If n
> 0 Then
factor
= 1
For
j = 1 To n
factor
= factor * j
Next
j
End
If
End
Function
Private
Sub CommandButton2_Click()
Res = MsgBox("Ymax=" & Str(max) &
"при x=" & Str(xmax), ,
"Максимум Y")
End
Sub