题目内容:
下列程序计算Sn的值。Sn=a+aa+aaa+…+aaa…,其中最后一项为n个。
例如:a=5,n=4时,则Sn=5+55+555+5555。请在空白处填入适当的内容,将程序补充完整。
Private Sub Command1_Click()
Dim a As Integer,n As Integer, Cout As Integer
Dim Sn As Long, Tn As Long
Cout=1
Sn=0
Tn=0
a=InputBox("请输入a的值:")
(12)
Do
Tn=Tn*10+a
Sn=Sn+Tn
Cout=Cout+1
(13)
Debug.Print a,n,Sn
End Sub
参考答案: