SERIE DEL FIBONACI

Anuncio
SERIE DEL FIBONACI
NOMBRE : Luis Bejarano
Curso: 6º “G”
Public Class Form1
Private Sub Button1_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs)
Handles Button1.Click
Dim n, a, b, c, i As Integer
n = TextBox1.Text
a = 0
b = 1
i = 3
Do While (i <= n)
c = a + b
a = b
b = c
i = i + 1
Loop
TextBox2.Text = c
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
Private Sub Button3_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs)
Handles Button3.Click
End
End Sub
End Class
EJERCICIO CON EL FACTORIAL
Public Class Form1
Private Sub Label2_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs)
Handles Label2.Click
End Sub
Private Sub Button1_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs)
Handles Button1.Click
Dim i, j, n, s, f As Integer
n = TextBox1.Text
i = 1
j = 1
f = 1
s = 0
Do While (i <= n)
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 Button2_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs)
Handles Button2.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
Descargar