永发信息网

速救vb编程,高手进来帮忙!!!

答案:4  悬赏:10  手机版
解决时间 2021-07-26 14:05
  • 提问者网友:蔚蓝的太阳
  • 2021-07-25 23:14

编程设定一个函数过程F(m),对一个四位数m判断:已知该整数m,逆向排列(如:2468逆向排列为8642)获得另一个4位数,是它自身的倍数(2倍以上)。主调程序调用该函数,显示1000~9999中所有满足该条件的数。

最佳答案
  • 五星知识达人网友:行路难
  • 2021-07-26 00:51

Dim S1 As String
Dim S2 As String
Dim NUMBER As Integer
For i = 1000 To 9999
S1 = Str(i)
S2 = StrReverse(S1)
NUMBER = Int(S2)
If ((NUMBER Mod i) = 0) Then


Print NUMBER
End If
Next i


全部回答
  • 1楼网友:春色三分
  • 2021-07-26 04:09

Dim S1 As String Dim S2 As String Dim NUMBER As Integer For I = 1000 To 9999 S1 = Str(I) S2 = StrReverse(S1) NUMBER = Int(S2) If ((NUMBER Mod I = 0) And (NUMBER / I) > 2) Then

Me.Print NUMBER End If Next I

  • 2楼网友:末日狂欢
  • 2021-07-26 03:41

Private Sub Command1_Click() For j = 1000 To 9999 Call F(j) Next End Sub

Public Sub F(m) Dim a For i = 4 To 1 Step -1 a = a + Mid(m, i, 1) Next If CInt(m) * 2 < CInt(a) Then List1.AddItem a End If

End Sub

  • 3楼网友:雾月
  • 2021-07-26 02:11

Function F(M As Integer) As Boolean Dim T As Integer T = Val(StrReverse(M)) If T Mod M = 0 And T \ M >= 2 Then F = True Else F = False End If End Function

Private Sub Command1_Click() Me.AutoRedraw = True Dim I As Integer For I = 1000 To 9999 If F(I) Then Print I; Next End Sub

我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯