求三位数中,个位数字与十位数字之和除以10所得的余数是百位数字,且百位数字是偶数的数的个数.Private Sub Form_click()Dim s As IntegerDim x As IntegerDim a As IntegerDim b As IntegerDim c As Integers = 0x = 100Do Whi
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/27 06:29:24
求三位数中,个位数字与十位数字之和除以10所得的余数是百位数字,且百位数字是偶数的数的个数.Private Sub Form_click()Dim s As IntegerDim x As IntegerDim a As IntegerDim b As IntegerDim c As Integers = 0x = 100Do Whi
求三位数中,个位数字与十位数字之和除以10所得的余数是百位数字,且百位数字是偶数的数的个数.
Private Sub Form_click()
Dim s As Integer
Dim x As Integer
Dim a As Integer
Dim b As Integer
Dim c As Integer
s = 0
x = 100
Do While x
求三位数中,个位数字与十位数字之和除以10所得的余数是百位数字,且百位数字是偶数的数的个数.Private Sub Form_click()Dim s As IntegerDim x As IntegerDim a As IntegerDim b As IntegerDim c As Integers = 0x = 100Do Whi
a = Int(x / 100) 这是取得x这个三位数的百位数
比如x=123,那么x/100=1.23,取整后就是1
b = Int(x / 10) - a * 100这个有误,正确的应该是b = Int(x / 10) - a * 10,这是取得十位数
比如还是上面的例子b = Int(123 / 10) - 1 * 10 = 12-10 = 2
c = x - a * 100 - b * 10 这是取得个位数
比如还是上面的例子c = x - a * 100 - b * 10 = 123 - 1*100 - 2*10 = 123 - 100 - 20 = 3
答案:横线处填入
((b + c) Mod 10) = a And (a Mod 2) = 0