vb求S=a+ aa+ aaa+ aaa...a(n个a)?当a=3,n=4最后输出形式如s=3+33+333+3333在线===快10悬赏..
发布网友
发布时间:2022-05-17 14:22
我来回答
共4个回答
热心网友
时间:2023-10-24 19:11
加两个文本框text1,text2,一个command1
private command1_click()
dim m as integer,n as integer
dim i as integer
dim Sum as long
m=val(text1.text)
n=val(text2.text)
for i=1 to n
sum=0
'这个循环有些难懂,要慢慢体会哦,把数字按每个位拆成不同的数字,比如333=300+30+3
for j=1 to n
sum=sum+(10-1)^j*m
next j
next i
end sub
热心网友
时间:2023-10-24 19:11
Private Sub Command2_Click()
Dim s#, a%, n%, i%
a = Val(InputBox("请输入A!"))
n = Val(InputBox("请输入N!"))
For i = 1 To n
s = s + Val(String(i, CStr(a)))
Next
Print s
End Sub
热心网友
时间:2023-10-24 19:12
private string function m(int a,int n)
for i =1 to n
if m<>"" then
m=m+"+"
end if
for j=1 to i
m=m+a
next
next
m="s="+m
end function
热心网友
时间:2023-10-24 19:12
Private Function Sum(ByVal a As Double, ByVal n As Double) As Double
Sum = (10 ^ (n + 1) - 10 - 9 * n) * a / 81
End Function