Find factors of a number in visual basic 6.0
Steps for the visual basic program to find the factors of the number
- Open Microsoft Visual Basic 6.0
- Create a new form
- Draw one label, one textbox, one Listbox, and two buttons.
- Double click on the display factors button and type the following code.
- Create the coding for clear button
- After that execute the program.
Source code for the factors of a number in visual basic 6.0
Private Sub Command1_Click()
Dim n, x As Integer
n = Val(Text1.Text)
For x = 2 To n - 1
If n Mod x = 0 Then
List1.AddItem (x)
End If
Next
List1.AddItem (n)
End Sub
Private Sub Command2_Click()
List1.Clear
Text1 = ""
End Sub
What are the factors of a number in visual basic 6
In the above, we have seen the basic concept of the visual basic factors of the number. Now we will see in detail about factors. So basically know that what is the factor, the factors are the numeric numbers that are the outcome of multiplied numbers. In the theoretically this is difficult to understand. But with the example, you can understand properly. So let’s see the examples of the factors of a number. Example: suppose you want to find the factors of the 24 then factors of 24 will be 2, 3, 4, 6, 8, 12, and 24. Now let’s see in more details
Factors of 24
2 * 12 = 24
3 * 8 = 24
4 * 6 = 24
6 * 4 = 24
8 * 3 = 24
12 * 2 = 24
24 * 1 =24
How to works this program in visual basic 6.0
Why you need the program of factors
of the number in vb 6.0
Yes! Yes! I know that this is the simple programs examples in visual basic 6.0. But do not ignore this. Because many times most of the students this type of simple program are not memories in the exam. Because these types’ simple visual basic program examples are ignored by the students. So without avoiding this program learn properly. By using this program you can develop simple desktop applications for finding the factors of mathematical expressions. That application will be helpful for science students and those students who are in mathematical fields. When you create the projects in visual basic 6.0. At that time this type of program is very helpful to you.
2 Comments
module fraction
ReplyDeleteDim num as integer
Dim n as integer = 2
Sub main()
Console.write("Enter the number: ")
num=console.readline()
Dim num1 as integer = num
If num>0
Do
if num mod n = 0 then
Console.write("Fraction is : " &n)
num=num/n
Do
if num mod n=0 then
Console.write(" " &n)
num=num/n
Else
n=n+1
End if
loop while n<num1
n=n+1
else
n=n+1
End if
loop while n<num1
End if
End sub
End module
Thank you Dear, For your comment. I think your logic also better for visual basic factorial number. you can send me easy solutions for visual basic programs i will publish your post here.
Delete