vb求m+mm+mmm+...+mm...mmm(n个m)要求 n ,m值 用 inputbox输入Dim m%,n%,i%,j%,a(0 To 9999999) As IntegerPrivate Sub Form_Click()m = InputBox("请输入m值 ")n = InputBox("请输入n值 ")For i = n To 0 Step -1a(n) = a(n) + 10 ^ (i - 1)Next iPrin
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/18 15:43:48
vb求m+mm+mmm+...+mm...mmm(n个m)要求 n ,m值 用 inputbox输入Dim m%,n%,i%,j%,a(0 To 9999999) As IntegerPrivate Sub Form_Click()m = InputBox("请输入m值 ")n = InputBox("请输入n值 ")For i = n To 0 Step -1a(n) = a(n) + 10 ^ (i - 1)Next iPrin
vb求m+mm+mmm+...+mm...mmm(n个m)
要求 n ,m值 用 inputbox输入
Dim m%,n%,i%,j%,a(0 To 9999999) As Integer
Private Sub Form_Click()
m = InputBox("请输入m值 ")
n = InputBox("请输入n值 ")
For i = n To 0 Step -1
a(n) = a(n) + 10 ^ (i - 1)
Next i
Print SUM(m,n)
End Sub
Private Function SUM(m As Integer,n As Integer) As Long
If n = 1 Then
SUM = m
Else
SUM = m * a(n) + SUM(m,(n - 1))
End If
End Function
帮忙把这个改一改
vb求m+mm+mmm+...+mm...mmm(n个m)要求 n ,m值 用 inputbox输入Dim m%,n%,i%,j%,a(0 To 9999999) As IntegerPrivate Sub Form_Click()m = InputBox("请输入m值 ")n = InputBox("请输入n值 ")For i = n To 0 Step -1a(n) = a(n) + 10 ^ (i - 1)Next iPrin
Private Sub Command1_Click()
Dim i As Integer,n As Integer,m As Integer,Str As String,S As Double
Str = ""
n = Val(InputBox("N"))
m = Val(InputBox("M"))
For i = 0 To n
S = S + Val(Str)
Str = Str & m
Next i
Print S
End Sub