level 5
伊阁笑
楼主
求大佬!如何在label中打印出完数的表达式?比如6=1+2
+3
这是我的代码,要如何增添打印完数的表达式的代码
Private Sub Command1_Click()
Dim a As Integer
Dim i As Long
Dim j As Long
a = Val(Text1.Text)
For i = 1 To a / 2
If a Mod i = 0 Then j = j + i '因子之和
Next i
If j = a Then
Label2.Caption = Val(Text1.Text) & "是完数"
Else
Label2.Caption = Val(Text1.Text) & "不是完数"
End If
End Sub

2020年06月25日 15点06分
1
+3
这是我的代码,要如何增添打印完数的表达式的代码
Private Sub Command1_Click()
Dim a As Integer
Dim i As Long
Dim j As Long
a = Val(Text1.Text)
For i = 1 To a / 2
If a Mod i = 0 Then j = j + i '因子之和
Next i
If j = a Then
Label2.Caption = Val(Text1.Text) & "是完数"
Else
Label2.Caption = Val(Text1.Text) & "不是完数"
End If
End Sub
