vb代码如下:
Private Sub Command1_Click()
Dim m As Long, s As Long
m = InputBox("请输入一个三位数整数")
If Not IsNumeric(m) Then MsgBox "你输入的不是数字": Exit Sub
If m < 100 Or m > 1000 Then MsgBox "你输入的不是三位整数": Exit Sub
For i = 1 To Len(m) - 1
s = s + CInt(Mid(m, i, 1))
Next
Print "数字" & m & "的各位之和:" & s
Dim a As Long, b As Long, c As Long
a = m \ 100
b = (m - a * 100) \ 10
c = m Mod 10
Print "数字" & m & "的反序:" & c & b & a
End Sub