怎样用VB编写3527的各位数字之和

来源:百度知道 编辑:UC知道 时间:2024/09/25 21:21:20
谢谢哥哥姐姐帮忙

dim n as integer,s as sting
s="3527"
for i=1 to len(s)
n=n+mid(s,i,1)
next
msgbox n

Private Sub Command1_Click()
Dim n As Long
For e = 1 To 3527
n = n + e
Next
MsgBox n
End Sub

Dim a As Integer
a = Val(Mid(3527, 1, 1)) + Val(Mid(3527, 2, 1)) + Val(Mid(3527, 3, 1)) + Val(Mid(3527, 4, 1))

同意billf512

只是第一行少了一个"R"应为
dim n as integer,s as string