PANTALLA PRINCIPAL FACTORIAL DE UN NÚMERO

Anuncio
PANTALLA PRINCIPAL
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Form2.Show()
Me.Hide()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
Form3.Show()
Me.Hide()
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
Form4.Show()
Me.Hide()
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button4.Click
Form5.Show()
Me.Hide()
End Sub
End Class
FACTORIAL DE UN NÚMERO
Public Class Form2
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
Form1.Show()
Me.Hide()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim N, F, I As Integer
N = TextBox1.Text
F = 1
I = 1
Do While I <= N
F = F * I
I = I + 1
Loop
TextBox2.Text = F
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
TEXTBOX1.TEXT = " "
TEXTBOX2.TEXT = " "
End Sub
End Class
POTENCIA DE UN NÚMERO
Public Class Form3
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
Form1.Show()
Me.Hide()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim N, F, P, I As Integer
N = TextBox1.Text
F = TextBox2.Text
I = 1
P = 1
Do While I <= F
P = P * N
I = I + 1
Loop
TextBox3.Text = P
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
TextBox1.Text = " "
TextBox2.Text = " "
TextBox1.Text = " "
End Sub
End Class
FIBONACCI DE UN NÚMERO
Public Class Form4
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
Form1.Show()
Me.Hide()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim a, b, p, s, i As Integer
a = TextBox1.Text
p = 0
s = 1
i = 3
Do While i <= a
b = p + s
p = s
s = b
i = i + 1
Loop
TextBox2.Text = b
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
TEXTBOX1.TEXT = " "
TEXTBOX2.TEXT = " "
End Sub
End Class
OTROS
MAYOR DE TRES NÚMERO
Public Class Form5
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
End
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
TextBox1.Text = " "
TextBox2.Text = " "
TextBox3.Text = " "
TextBox4.Text = " "
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim a, b, c As Integer
a = TextBox1.Text
b = TextBox2.Text
c = TextBox3.Text
If a > b And a > c Then
TextBox4.Text = +Str(a)
Else
If b > a And b > c Then
TextBox4.Text = +Str(b)
Else
TextBox4.Text = +Str(c)
End If
End If
End Sub
End Class
Descargar