Descarga

Anuncio
CURSO: 6”G”
NOMBRE: JESSICA SANUNGA
FACTORIAL DE UN NÚMERO N
Public Class Form1
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button2.Click
Dim n, a, b, i, c As Integer
n = TextBox1.Text
a = 0
b = 1
i = 2
Do While (i <= n)
c = a + b
a = b
b = c
i = i + 1
Loop
TextBox2.Text = c
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button1.Click
TextBox1.Text = " "
TextBox2.Text = " "
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button3.Click
End
End Sub
End Class
CURSO: 6”G”
NOMBRE: JESSICA SANUNGA
FACTORIAL DE UN NÚMERO
Public Class Form1
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button2.Click
Dim i, j, f, s, n As Integer
n = TextBox1.Text
s = 0
Do While i <= n
j = 1
f = 1
Do While j <= i
f = f * j
j = j + 1
Loop
s = s + f
i = i + 1
Loop
TextBox2.Text = s
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button1.Click
TextBox1.Text = " "
TextBox2.Text = " "
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button3.Click
End
End Sub
End Class
Descargar