Professional Documents
Culture Documents
092
092
----------------------------------------------------------------------------
Dim n As Integer = TextBox1.Text
Dim sumatoria, r As Integer
For j = 1 To n
If n Mod j = 0 Then
sumatoria = sumatoria + j
End If
Next
r = sumatoria - n
If r = n Then
MsgBox(" es un numero perfecto")
Else
MsgBox(" no es un numero perfecto")
End If
_______________________________________________________________________
NUmero Primo
---------------------------------------------------------------
Dim n As Integer
Dim Cont As Integer = 0
While True
For i As Integer = 1 To n
If (n Mod i = 0) Then
Cont = Cont + 1
End If
Next
Else
Console.WriteLine("El numero es primo")
End If
Cont = 0
End While
___________________________________________________________________________________
_____
Factorial
-----------------------------------------------------------------------------------
--
Dim Fac As Long = 1
Dim n As Integer