大橙子网站建设,新征程启航
为企业提供网站建设、域名注册、服务器等服务
Private Sub Command1_Click()
专注于为中小企业提供成都网站制作、成都做网站服务,电脑端+手机端+微信端的三站合一,更高效的管理,为中小企业景东免费做网站提供优质的服务。我们立足成都,凝聚了一批互联网行业人才,有力地推动了上千余家企业的稳健成长,帮助中小企业通过网站建设实现规模扩充和转变。
Dim A, B, C
A = 10
B = 3
C = f(A) / (f(B) * f(A - B))
Print C
End Sub
Private Function f(n)
Dim I As Integer
f = 1
For I = 1 To n
f = f * I
Next I
End Function
都是VB6.0上测试通瞎李过没有问题的程序。
1,逆序数告拆计算磨友迟
Private Function ReversOrder(ByVal InStr As String) As Long
Dim i As Integer, j As Integer, c As Long
Dim n() As Integer
ReDim n(Len(InStr))
For i = 1 To Len(InStr)
n(i) = Val(Mid(lnStr, i, 1))
For j = 1 To i - 1
If n(i) n(j) Then
c = c + 1
End If
Next j
Next i
ReversOrder = c
End Function
2. 级数有限项求和
Private Sub Command1_click()
n = 0
For i = 1 To 100 '1 到100 项,你可改为你的项数
n = n + 1 / i '对级数的前100项求和:1/1+1/2+1/3+1/4...+1/100,你可改成你的级数
Next i
Text1.Text = Str(n) '在textbox里显示结果
End Sub
Private Sub Form_Click()
Dim sum#, n#, i#, sign%
sum = 0: n = 1: i = 1: sign = 1
Do
sum = sum + n
i = i + 3
sign = -sign
n = sign / i
Loop Until n 0.01
Print "级数猜搭求和得结果庆兆迟为誉李S=" sum
End Sub
'希望对你有帮助!~ ^_^b