Professional Documents
Culture Documents
Codigos Usados en Factoriales
Codigos Usados en Factoriales
Dim N As Long
Dim FACT As Long
Dim TEMP As Long
N = Val(NUM1.Text)
If N = 0 Then
NUM2.Text = Str(1)
Else
If N = 1 Then
NUM2.Text = Str(1)
Else
FACT = N
TEMP = FACT - 1
FACT = FACT * TEMP
While TEMP > 1
TEMP = TEMP - 1
FACT = FACT * TEMP
End While
If TEMP = 1 Then
NUM2.Text = Str(FACT)
End If
End If
End If
End Sub
DIAGRAMA DE FLUJOS
FACTORIAL