0% found this document useful (0 votes)
21 views

Public Class Private Sub Byval As Byval As Handles Dim As Integer

The document contains code for a Windows form application that performs three calculations: 1) It checks if a number is prime by dividing it by all numbers up to the number and counting the divisors. 2) It calculates exponents by multiplying a base number by itself the number of times specified by the exponent. 3) It clears the text boxes and label when a "Clear" button is clicked and exits the application when a "Exit" button is clicked.

Uploaded by

nestor chambi
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views

Public Class Private Sub Byval As Byval As Handles Dim As Integer

The document contains code for a Windows form application that performs three calculations: 1) It checks if a number is prime by dividing it by all numbers up to the number and counting the divisors. 2) It calculates exponents by multiplying a base number by itself the number of times specified by the exponent. 3) It clears the text boxes and label when a "Clear" button is clicked and exits the application when a "Exit" button is clicked.

Uploaded by

nestor chambi
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Public Class Form1

Private Sub BTOCALCULAR_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles BTOCALCULAR.Click
Dim NUM, I, CD, RES As Integer
NUM = Val(TXTNUM.Text)
I = 0
CD = 0
Do While I < NUM
I = I + 1
If NUM Mod I = 0 Then
CD = CD + 1

End If
Loop
I = I + 1
If NUM Mod I = 0 Then
CD = CD + 1

End If
If CD = 2 Then
LBLRES.Text = " ES PRIMO "
Else
LBLRES.Text = " NO ES PRIMO "
End If
End Sub

Private Sub BTOLIMPIAR_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles BTOLIMPIAR.Click
TXTNUM.Text = ""
LBLRES.Text = ""
End Sub

Private Sub BTOSALIR_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles BTOSALIR.Click
End
End Sub
End Class
Public Class Form1
Private Sub BTOCALCULAR_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles BTOCALCULAR.Click
Dim NUM, I, CD, RES As Integer
NUM = Val(TXTNUM.Text)
I = 0
CD = 0
Do While I < NUM
I = I + 1
If NUM Mod I = 0 Then
CD = CD + 1

End If
Loop

I = I + 1
If NUM Mod I = 0 Then
CD = CD + 1

End If
If CD = 2 Then
LBLRES.Text = " ES PRIMO "
Else
LBLRES.Text = " NO ES PRIMO "
End If
End Sub

Private Sub BTOLIMPIAR_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles BTOLIMPIAR.Click
TXTNUM.Text = ""
LBLRES.Text = ""
End Sub

Private Sub BTOSALIR_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles BTOSALIR.Click
End
End Sub
End Class
Public Class Form1

Private Sub BTOCALCULAR_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles BTOCALCULAR.Click
Dim BASE, EXP, RES As Integer
BASE = Val(TXTBASE.Text)
EXP = Val(TXTEXP.Text)
RES = 1
For C = 1 To EXP Step 1
RES = RES * BASE
Next
LBLRES.Text = " EL RESULTADO ES " & RES
End Sub

Private Sub BTOLIMPIAR_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles BTOLIMPIAR.Click
TXTBASE.Text = ""
TXTEXP.Text = ""
LBLRES.Text = ""
End Sub

Private Sub BTOSALIR_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles BTOSALIR.Click
End
End Sub
End Class
Public Class Form1

Private Sub BTOCALCULAR_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles BTOCALCULAR.Click
Dim BASE, EXP, RES As Integer
BASE = Val(TXTBASE.Text)
EXP = Val(TXTEXP.Text)
RES = 1
For C = 1 To EXP Step 1
RES = RES * BASE
Next
LBLRES.Text = " EL RESULTADO ES " & RES
End Sub

Private Sub BTOLIMPIAR_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles BTOLIMPIAR.Click
TXTBASE.Text = ""
TXTEXP.Text = ""
LBLRES.Text = ""
End Sub

Private Sub BTOSALIR_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles BTOSALIR.Click
End
End Sub
End Class

You might also like