帮忙解决3道VB题 谢谢了

2025-01-05 01:26:43
推荐回答(1个)
回答1:

1.

Dim a As Long, b As Long, c As Long '原数
Dim a2 As Long, b2 As Long, c2 As Long '排序后数
'最大
a2 = a
If a2 < b Then a2 = b
If a2 < c Then a2 = c
a = i
'中
b2 = a
If b < a And b > c Then b2 = b
If c < a And c > b Then b2 = c
'最小
c2 = a
If a2 > b Then a2 = b
If a2 > c Then a2 = c

a = a2
b = b2
c = c2

2.
Private Function sushu(ByVal n As Long) As Boolean
Dim i As Long

For i = 2 To Int(Sqr(m))
If (n Mod i) = 0 Then Exit For
Next i
If i = n Then sushu = True
End Function

3.
Dim str As String
If str = StrReverse(str) Then
MsgBox "回文数"
End If