function S(x as single, n as single) as double
dim i as long
dim j as long
dim k as long
if n < 2 then
s = 0
elseif n = 2 then
s = x / 2
else
s = x / 2
for i = 3 to n + 1 step 1
k = i
for j = i - 1 to 2 step -1
k = k * i
next
s = s + x ^ (i - 1) / k
next
end if
end function
是不是这样子? 我手里没有VB不能测试
Private Sub Command1_Click()
Dim i As Integer, j As Integer, n As Integer, x As Double, s As Double, a As Double, b As Double
x = Val(Text1): n = Val(Text2)
For i = 1 To n
a = 1
For j = 1 To i + 1
a = a * j
Next
b = x ^ i / a
s = s + b
Next
Text3 = s
End Sub
Private Sub command1_click()
jc# = 1
s# = 0
x% = Val(InputBox("X"))
n% = Val(InputBox("N"))
For i = 1 To n
jc = jc * (i + 1)
s = s + x ^ i / jc
Next
Print s
End Sub
private sub command1_click()
dim x as single,n as integer,s as single,i as integer
x=inputbox("输入X值")
n=inputbox("输入N值")
for i = 1 to n
s=s+x^i/fac(i+1)
next i
print s
end sub
private function fac(n as intger) as long
dim i as integer
fac=1
for i = 1 to n
fac=fac*i
next i
end function