• 主页

# 帮我进来看到题目 就10行 帮帮忙 在线等

lhbyjx 2008-01-04 10:55:42

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim x, a, b, c, d, q As Integer
For x = 1000 To 10000
q = x
a = x / 1000
b = (x Mod 1000) / 100
c = (x Mod 100) / 10
d = (x Mod 10)
If (q * 9) = (1000 * d + 100 * c + 10 * b + a) Then
TextBox1.Text() = q
End If
Next
End Sub
End Class
...全文
44 点赞 收藏 8

8 条回复

``````  Dim x, a, b, c, d, q As Integer
For x = 1000 To 1111
q = x
a = x \ 1000
b = x \ 100 Mod 10
c = x \ 10 Mod 10
d = x Mod 10
If (q * 9) = (1000 * d + 100 * c + 10 * b + a) Then
Text1.Text() = q
End If
Next``````

DIM A AS LONG
DIM B AS LONG
DIM C AS LONG
DIM D AS LONG
DIM I AS LONG
FOR I=1000 TO 1111
A=I MOD 10
B=(I\10) MOD 10
C=(I\100) MOD 10
D=I\1000
IF I*9 = A*1000+B*100+C*10+D THEN ME.PRINT I
NEXT

lhbyjx 2008-01-04

ABCD * 9=DCBA
A只能为1,D只能为9
1BC9 * 9=9CB1
B=C+8，B又只能为0和1

1029*9=9261

abcd * 9 =dcba
abcd最小可能值为1111，此时1111*9=9999

VB基础类

7453

VB 基础类