martes, 11 de noviembre de 2008

CALCULAR LA SUMA DE LOS PRIMEROS N, NUMEROS NATURALES


Dim res, num1, cont As Double

Private Sub Command1_Click()

For cont = 0 To num1
res = res + cont
Text2.Text = res
Next


End Sub

Private Sub Command2_Click()
Text1.Text = " "
Text2.Text = " "
Text1.SetFocus
res = 0
num1 = 0
cont = 0
End Sub

Private Sub Command3_Click()
End
End Sub



Private Sub Text1_Change()
If Text1.Text <> " " Then
num1 = Val(Text1.Text)
End If
End Sub

No hay comentarios: