急!!!!求大神帮忙看看这道题对不对 问题:输入一个4位正整数,输出各位数字之和 VB语言
按照书上例题做的,但是在系统上出了点问题就自己改了一下,不知正确与否PrivateSubCommand1_Click()DimxAsInteger,sAsIntegerD...
按照书上例题做的,但是在系统上出了点问题就自己改了一下,不知正确与否
Private Sub Command1_Click()
Dim x As Integer, s As Integer
Dim a As Integer, b As Integer
Dim c As Integer, d As Integer
x = InputBox("请输入一个4位正整数")
a = x Mod 10
b = x \ 10 Mod 10
c = x \ 100 Mod 10
d = x Mod 1000
s = a + b + c + d
Print x; "的各位数字之和为:"; s
End Sub 展开
Private Sub Command1_Click()
Dim x As Integer, s As Integer
Dim a As Integer, b As Integer
Dim c As Integer, d As Integer
x = InputBox("请输入一个4位正整数")
a = x Mod 10
b = x \ 10 Mod 10
c = x \ 100 Mod 10
d = x Mod 1000
s = a + b + c + d
Print x; "的各位数字之和为:"; s
End Sub 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询