vb 判断一个数是不是完数.docVIP

  • 80
  • 0
  • 约 10页
  • 2017-05-17 发布于湖北
  • 举报
判断一个数是不是完数 Private Sub Command1_Click() Dim m As Integer, i As Integer, j As Integer, sum As Integer Dim a() As Integer m = Text1.Text For i = 1 To m - 1 If m Mod i = 0 Then sum = sum + i j = j + 1 ReDim Preserve a(i) As Integer a(i) = i End If Next i If m = sum Then Picture1.Print m 是完数,因为 Picture1.Print m; =; For i = 1 To UBound(a) - 1 Picture1.Print a(i); +; Next i Picture1.Print a(i) Else Picture1.Print m 不是完数 End If End Sub Private Sub Command2_Click() Picture1.Cls Text1.Text = Text1.SetFocus End Sub Private Sub Command3_Click() End End Sub 选择排序法 Option Explicit Option Base 1 Private S

文档评论(0)

1亿VIP精品文档

相关文档