Agujero Negro Numérico 123
Visual Basic para Aplicaciones
1.570 visualizaciones desde el 2 de Septiembre del 2018
Dim I As Long
Dim A As Integer
Dim B As Integer
Dim C As Integer
Dim T1 As Integer
Dim T2 As Integer
Dim V As Double
With Hoja1
'If Len(.Cells(2, 1)) > 15 Then MsgBox "DEBE SER DE 15 NUMEROS": Exit Sub
.Range("B:D").Clear
.Cells(1, 1) = "AGUJERO NEGRO NUMÉRICO"
.Cells(1, 2) = " DEL NUMERO " & .Cells(2, 1)
.Cells(2, 2) = "NUMEROS DESCOMPUESTOS"
.Cells(2, 3) = "PARES"
.Cells(2, 4) = "IMPARES"
A = 3
B = 3
C = 3
T1 = 0
T2 = 0
V = 0
Do Until V = 123
T1 = 0 'Numeros pares
T2 = 0 'Numeros impares
For I = 1 To Len(.Cells(2, 1))
If Mid(.Cells(2, 1), I, 1) Mod 2 = 0 Then
.Cells(A, 3) = Mid(.Cells(2, 1), I, 1)
A = A + 1
T1 = T1 + 1
Else
.Cells(B, 4) = Mid(.Cells(2, 1), I, 1)
T2 = T2 + 1
B = B + 1
End If
Next I
V = T1 & T2 & T1 + T2
.Cells(2, 1) = V
.Cells(C, 2) = V
C = C + 1
Loop
End With
Comentarios sobre la versión: Versión 1.0 (0)
No hay comentarios