Hello students!
This article is going to discuss about the Visual Basic 6.0 code on how to find or get all the factors of the number entered by the user.
In getting factor of a number you must consider the following objects:
1. one form
SOURCE CODE:
Dim num, x As Integer
Private Sub Command1_Click()
On Error GoTo handler:
List1.Clear
num = CInt(Text1)
For x = 1 To num
If num Mod x = 0 Then
List1.AddItem x
End If
Next x
Exit Sub
handler:
MsgBox "Not a number", vbExclamation, "Status"
End Sub
If you want the JAVA code for getting all the factors of a number just click
For more information keep checking itlibraryetc.blogspot.com
This article is going to discuss about the Visual Basic 6.0 code on how to find or get all the factors of the number entered by the user.
In getting factor of a number you must consider the following objects:
1. one form
- Form1 - has a caption of "Getting Factors"
- Label1 - has a caption of "Enter Number:"
- Textbox1 - is where an integer to be factor will be inputted (Text: must be emptied)
- List1-is where all the factors of an integer will display
- Command1 -use for an action, which will produce a factors of an integer (Caption: Get Factors)
SOURCE CODE:
Dim num, x As Integer
Private Sub Command1_Click()
On Error GoTo handler:
List1.Clear
num = CInt(Text1)
For x = 1 To num
If num Mod x = 0 Then
List1.AddItem x
End If
Next x
Exit Sub
handler:
MsgBox "Not a number", vbExclamation, "Status"
End Sub
If you want the JAVA code for getting all the factors of a number just click
For more information keep checking itlibraryetc.blogspot.com


No comments:
Post a Comment