x = Val(InputBox( x))
n = Val(InputBox( n))
y = Exp(-2 * x) + 1
z = Log(x) / (x + 1)
If x < z ^ 2 Then w = Sqr(x * y) Else w = n * x + 2
Msgbox (w= & w)
Excel. MsgBox
Worksheets(1).Range(a1)=w
w 1 1.
2 y . n x :
.
Private Sub CommandButton1_Click()
Dim x As Single, n As Single, y As Single
'
x = Val(InputBox(" x "))
n = Val(InputBox(" n"))
'
If x >= 0 And n >= 0 Then y = Sqr(x)
If x < 0 And n < 0 Then y = n * x + 2
MsgBox ((y= & y) '
End Sub
3 y If:
.
Private Sub CommandButton1_Click()
Dim x As Single, y As Single
x = Val(InputBox(" x "))
If x<0 Then y =x+5 Else If x<=5 Then y=Sqr(3*x) Else y =x^2
MsgBox (y)
End Sub
4 ( If). y=sin2x, w=ctgx, <5; y=1-sinx, w=arctgx, ³ 5.
={9; 0.1; -4; 5; 12}
Private Sub CommandButton1_Click()
Dim x As Single, y As Single, z As Single
Dim w As Single, I As Integer
For i=1 to 5
x = Val(InputBox(" "))
'
If x > 5 Then
y = Sin(x)^2
w = cos(x)/sin(x)
Else
y = 1 - Sin(x)
w = Atn(x)
End If
MsgBox (x= & x & y= & y & w= & w)
Next
End Sub
5. n:
, x=1,7 s=5,2 j .
2 (. 6.1). 2 , .
. 6.1 − Excel
If :
Private Sub CommandButton1_Click()
Worksheets(" ").Range("c2") = " " 2
Dim x As Single, s As Single, v As Single, j As Single
x=Val(InputBox( ))
s=Val(InputBox( s))
j = Worksheets(" ").Range("i19")
If x * j < 2 * s Then v = Cos(x * j) ^ 2 Else If x * j >= 2 * s And _
x * j <= 3 * s Then v = 2 * Tan(j * x) Else v = 5 - Exp(x / 2)
MsgBox (" v=" & Format(v, "##.####"))
End Sub
D23 :
|
|
=(D19*I19<2*F19;COS(I19*D19)*COS(I19*D19);((D19*I19>=2*F19;D19*I19<=3*F19);2*TAN(I19*D19);5-EXP(D19:D19/2)))
, Excel VBA .
1. .
2. , . 6.1.
6.1